summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcanvas/source/directx/dx_canvashelper_texturefill.cxx2
-rw-r--r--comphelper/inc/comphelper/TypeGeneration.hxx1
-rw-r--r--comphelper/inc/comphelper/asyncnotification.hxx3
-rw-r--r--comphelper/inc/comphelper/documentconstants.hxx1
-rwxr-xr-xcomphelper/inc/comphelper/flagguard.hxx83
-rw-r--r--comphelper/inc/comphelper/scopeguard.hxx15
-rw-r--r--comphelper/source/misc/scopeguard.cxx10
-rw-r--r--comphelper/source/property/TypeGeneration.cxx4
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx17
-rw-r--r--i18npool/inc/i18npool/paper.hxx7
-rw-r--r--i18npool/source/breakiterator/breakiteratorImpl.cxx4
-rw-r--r--i18npool/source/paper/paper.cxx6
-rw-r--r--l10ntools/source/filter/utils/Cache.java8
-rw-r--r--svl/inc/svl/undo.hxx352
-rw-r--r--svl/source/undo/undo.cxx1203
-rw-r--r--svtools/inc/svtools/textdata.hxx20
-rw-r--r--svtools/inc/svtools/texteng.hxx13
-rw-r--r--svtools/inc/svtools/xtextedt.hxx4
-rw-r--r--svtools/source/contnr/svtreebx.cxx4
-rwxr-xr-xsvtools/source/control/inettbc.cxx3
-rw-r--r--svtools/source/edit/texteng.cxx16
-rw-r--r--svtools/source/edit/textundo.cxx29
-rw-r--r--svtools/source/edit/textundo.hxx8
-rw-r--r--svtools/source/edit/textview.cxx32
-rw-r--r--svtools/source/edit/xtextedt.cxx8
-rw-r--r--svtools/source/misc/templatefoldercache.cxx11
-rw-r--r--svtools/source/uno/unoiface.cxx2
-rw-r--r--toolkit/Library_tk.mk8
-rw-r--r--toolkit/Package_inc.mk1
-rwxr-xr-xtoolkit/inc/toolkit/awt/animatedimagespeer.hxx106
-rw-r--r--toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx90
-rw-r--r--toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx82
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx2
-rw-r--r--toolkit/inc/toolkit/awt/xsimpleanimation.hxx27
-rw-r--r--toolkit/inc/toolkit/awt/xthrobber.hxx26
-rwxr-xr-xtoolkit/inc/toolkit/controls/animatedimages.hxx144
-rw-r--r--toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx261
-rw-r--r--toolkit/inc/toolkit/controls/dialogcontrol.hxx206
-rw-r--r--toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx1
-rw-r--r--toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx6
-rwxr-xr-xtoolkit/inc/toolkit/controls/spinningprogress.hxx70
-rw-r--r--toolkit/inc/toolkit/controls/tabpagecontainer.hxx147
-rw-r--r--toolkit/inc/toolkit/controls/tabpagemodel.hxx147
-rw-r--r--toolkit/inc/toolkit/controls/tksimpleanimation.hxx18
-rw-r--r--toolkit/inc/toolkit/controls/unocontrols.hxx1
-rw-r--r--toolkit/inc/toolkit/helper/listenermultiplexer.hxx8
-rw-r--r--toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx2
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx1
-rw-r--r--toolkit/inc/toolkit/helper/servicenames.hxx10
-rw-r--r--toolkit/inc/toolkit/helper/throbberimpl.hxx84
-rw-r--r--toolkit/inc/toolkit/helper/tkresmgr.hxx1
-rwxr-xr-xtoolkit/source/awt/animatedimagespeer.cxx538
-rw-r--r--toolkit/source/awt/vclxtabpagecontainer.cxx233
-rw-r--r--toolkit/source/awt/vclxtabpagemodel.cxx150
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx57
-rw-r--r--toolkit/source/awt/vclxwindow.cxx29
-rw-r--r--toolkit/source/awt/vclxwindows.cxx61
-rw-r--r--toolkit/source/awt/xsimpleanimation.cxx116
-rw-r--r--toolkit/source/awt/xthrobber.cxx76
-rwxr-xr-xtoolkit/source/controls/animatedimages.cxx491
-rw-r--r--toolkit/source/controls/controlmodelcontainerbase.cxx1811
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx1739
-rwxr-xr-xtoolkit/source/controls/spinningprogress.cxx138
-rw-r--r--toolkit/source/controls/tabpagecontainer.cxx301
-rw-r--r--toolkit/source/controls/tabpagemodel.cxx404
-rw-r--r--toolkit/source/controls/tksimpleanimation.cxx55
-rw-r--r--toolkit/source/controls/unocontrolcontainer.cxx1
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx2
-rw-r--r--toolkit/source/controls/unocontrols.cxx7
-rw-r--r--toolkit/source/helper/listenermultiplexer.cxx6
-rw-r--r--toolkit/source/helper/property.cxx4
-rw-r--r--toolkit/source/helper/registerservices.cxx45
-rw-r--r--toolkit/source/helper/servicenames.cxx8
-rw-r--r--toolkit/source/helper/throbberimpl.cxx138
-rw-r--r--toolkit/source/helper/tkresmgr.cxx35
-rw-r--r--toolkit/util/tk.component21
-rw-r--r--unotools/inc/unotools/pathoptions.hxx5
-rw-r--r--unotools/source/config/pathoptions.cxx101
-rw-r--r--vcl/inc/vcl/fixed.hxx4
-rw-r--r--vcl/inc/vcl/imgctrl.hxx14
-rw-r--r--vcl/inc/vcl/throbber.hxx103
-rw-r--r--vcl/prj/d.lst1
-rw-r--r--vcl/source/control/imgctrl.cxx192
-rw-r--r--vcl/source/control/makefile.mk22
-rw-r--r--vcl/source/control/throbber.cxx325
-rw-r--r--vcl/source/src/makefile.mk3
-rwxr-xr-xvcl/source/src/throbber.src114
-rw-r--r--vcl/workben/svpclient.cxx2
88 files changed, 7643 insertions, 3024 deletions
diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx
index 80224aa3d53c..17d5a2983f7c 100755
--- a/canvas/source/directx/dx_canvashelper_texturefill.cxx
+++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx
@@ -227,6 +227,7 @@ namespace dxcanvas
Gdiplus::SolidBrush aBackgroundBrush( rColors[0] );
rGraphics->FillPath( &aBackgroundBrush, pFillPath.get() );
+ Gdiplus::Matrix aMatrix;
// scale focus according to aspect ratio: for wider-than-tall
// bounds (nAspectRatio > 1.0), the focus must have non-zero
// width. Specifically, a bound rect twice as wide as tall has
@@ -383,7 +384,6 @@ namespace dxcanvas
// one sets both, only the translational components of the
// texture is respected.
- Gdiplus::Matrix aMatrix;
tools::gdiPlusMatrixFromAffineMatrix2D( aMatrix,
texture.AffineTransform );
GraphicsPathSharedPtr pGradientPath(
diff --git a/comphelper/inc/comphelper/TypeGeneration.hxx b/comphelper/inc/comphelper/TypeGeneration.hxx
index 6660e560f4af..08401cb39944 100644
--- a/comphelper/inc/comphelper/TypeGeneration.hxx
+++ b/comphelper/inc/comphelper/TypeGeneration.hxx
@@ -115,6 +115,7 @@ namespace comphelper
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_END
};
diff --git a/comphelper/inc/comphelper/asyncnotification.hxx b/comphelper/inc/comphelper/asyncnotification.hxx
index fc4dfcd48dd9..22d901728ef7 100644
--- a/comphelper/inc/comphelper/asyncnotification.hxx
+++ b/comphelper/inc/comphelper/asyncnotification.hxx
@@ -131,8 +131,9 @@ namespace comphelper
virtual oslInterlockedCount SAL_CALL acquire();
virtual oslInterlockedCount SAL_CALL release();
- /// creates (starts) the thread
using AsyncEventNotifier_TBASE::create;
+ using AsyncEventNotifier_TBASE::join;
+ using AsyncEventNotifier_TBASE::getIdentifier;
using AsyncEventNotifier_TBASE::operator new;
using AsyncEventNotifier_TBASE::operator delete;
diff --git a/comphelper/inc/comphelper/documentconstants.hxx b/comphelper/inc/comphelper/documentconstants.hxx
index 73b90d72cc8a..e53bb03ce773 100644
--- a/comphelper/inc/comphelper/documentconstants.hxx
+++ b/comphelper/inc/comphelper/documentconstants.hxx
@@ -136,7 +136,6 @@
#define SFX_FILTER_STARONEFILTER 0x00080000L
#define SFX_FILTER_PACKED 0x00100000L
-#define SFX_FILTER_SILENTEXPORT 0x00200000L
#define SFX_FILTER_BROWSERPREFERED 0x00400000L
diff --git a/comphelper/inc/comphelper/flagguard.hxx b/comphelper/inc/comphelper/flagguard.hxx
new file mode 100755
index 000000000000..4fc1f4e97833
--- /dev/null
+++ b/comphelper/inc/comphelper/flagguard.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ * 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_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
diff --git a/comphelper/inc/comphelper/scopeguard.hxx b/comphelper/inc/comphelper/scopeguard.hxx
index 1fdd179404a2..e9c8f7ecc625 100644
--- a/comphelper/inc/comphelper/scopeguard.hxx
+++ b/comphelper/inc/comphelper/scopeguard.hxx
@@ -67,21 +67,6 @@ private:
exc_handling const m_excHandling;
};
-class COMPHELPER_DLLPUBLIC FlagGuard : ScopeGuard
-{
-public:
- explicit FlagGuard( bool& i_flagRef, exc_handling i_excHandling = IGNORE_EXCEPTIONS )
- :ScopeGuard( ::boost::bind( ResetFlag, ::boost::ref( i_flagRef ) ), i_excHandling )
- {
- }
-
-private:
- static void ResetFlag( bool& i_flagRef )
- {
- i_flagRef = false;
- }
-};
-
} // namespace comphelper
#endif // ! defined(INCLUDED_COMPHELPER_SCOPEGUARD_HXX)
diff --git a/comphelper/source/misc/scopeguard.cxx b/comphelper/source/misc/scopeguard.cxx
index 7ce478d8bea0..ccd5b618605b 100644
--- a/comphelper/source/misc/scopeguard.cxx
+++ b/comphelper/source/misc/scopeguard.cxx
@@ -28,7 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_comphelper.hxx"
-#include "comphelper/scopeguard.hxx"
+#include "comphelper/flagguard.hxx"
#include "osl/diagnose.h"
#include "com/sun/star/uno/Exception.hpp"
@@ -67,5 +67,13 @@ void ScopeGuard::dismiss()
m_func.clear();
}
+FlagGuard::~FlagGuard()
+{
+}
+
+FlagRestorationGuard::~FlagRestorationGuard()
+{
+}
+
} // namespace comphelper
diff --git a/comphelper/source/property/TypeGeneration.cxx b/comphelper/source/property/TypeGeneration.cxx
index bf880330ce75..649e50711d28 100644
--- a/comphelper/source/property/TypeGeneration.cxx
+++ b/comphelper/source/property/TypeGeneration.cxx
@@ -132,7 +132,8 @@
// --> OD 2004-08-09 #i28749#
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
// <--
-#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -230,6 +231,7 @@ namespace comphelper
case CPPUTYPE_SEQNAMEDVALUE: pType = &::getCppuType( (Sequence<beans::NamedValue>*)0 ); break;
case CPPUTYPE_REFXGRAPHIC: pType = &::getCppuType( (Reference< graphic::XGraphic >*)0); break;
case CPPUTYPE_TABLEBORDERDISTANCES: pType = &::getCppuType( (table::TableBorderDistances*)0 ); break;
+ case CPPUTPYE_REFEMBEDDEDOBJECT: pType = &embed::XEmbeddedObject::static_type(); break;
default:
OSL_ASSERT( "Unknown CPPU type" );
}
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 006d55a01de6..bab5826e54aa 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -682,10 +682,23 @@ namespace cppcanvas
case GRADIENT_AXIAL:
{
- basegfx::tools::createLinearODFGradientInfo(aGradInfo,
+ // Adapt the border so that it is suitable
+ // for the axial gradient. An axial
+ // gradient consists of two linear
+ // gradients. Each of those covers half
+ // of the total size. In order to
+ // compensate for the condensed display of
+ // the linear gradients, we have to
+ // enlarge the area taken up by the actual
+ // gradient (1-fBorder). After that we
+ // have to turn the result back into a
+ // border value, hence the second (left
+ // most 1-...
+ const double fAxialBorder (1-2*(1-fBorder));
+ basegfx::tools::createAxialODFGradientInfo(aGradInfo,
aBounds,
nSteps,
- fBorder,
+ fAxialBorder,
fRotation);
// map odf to svg gradient orientation - x
// instead of y direction
diff --git a/i18npool/inc/i18npool/paper.hxx b/i18npool/inc/i18npool/paper.hxx
index 76aebbe473d5..f0a7d76931b7 100644
--- a/i18npool/inc/i18npool/paper.hxx
+++ b/i18npool/inc/i18npool/paper.hxx
@@ -34,6 +34,10 @@
#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,
@@ -116,6 +120,9 @@ enum Paper
PAPER_ARCHE
};
+// defined for 'equal size' test with the implementation array
+#define NUM_PAPER_ENTRIES (PAPER_ARCHE - PAPER_A0 + 1)
+
// ---------
// - Paper -
// ---------
diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx
index d22203d100c7..19b175d4bd83 100644
--- a/i18npool/source/breakiterator/breakiteratorImpl.cxx
+++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx
@@ -448,6 +448,10 @@ typedef struct {
sal_Int16 script;
} UBlock2Script;
+// for a list of the UBLOCK_... values see:
+// http://icu-project.org/apiref/icu4c/uchar_8h.html
+// where enum UBlockCode is defined.
+// See also http://www.unicode.org/charts/ for general reference
static UBlock2Script scriptList[] = {
{UBLOCK_NO_BLOCK, UBLOCK_NO_BLOCK, ScriptType::WEAK},
{UBLOCK_BASIC_LATIN, UBLOCK_ARMENIAN, ScriptType::LATIN},
diff --git a/i18npool/source/paper/paper.cxx b/i18npool/source/paper/paper.cxx
index e94efa6e06c5..0d9235747fd6 100644
--- a/i18npool/source/paper/paper.cxx
+++ b/i18npool/source/paper/paper.cxx
@@ -27,6 +27,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_i18npool.hxx"
+
+#include <osl/diagnose.h>
#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <rtl/string.hxx>
@@ -129,7 +131,6 @@ static PageDesc aDinTab[] =
{ MM2MM100( 227 ), MM2MM100( 356 ), "SuperA", NULL },
{ MM2MM100( 305 ), MM2MM100( 487 ), "SuperB", NULL },
{ IN2MM100( 8.5 ), IN2MM100( 12.69 ), "LetterPlus", NULL },
- { IN2MM100( 8.5 ), IN2MM100( 12.69 ), "LetterPlus", NULL },
{ MM2MM100( 210 ), MM2MM100( 330 ), "A4Plus", NULL },
{ MM2MM100( 200 ), MM2MM100( 148 ), "DoublePostcard", NULL },
{ MM2MM100( 105 ), MM2MM100( 148 ), "A6", NULL },
@@ -385,6 +386,9 @@ PaperInfo PaperInfo::getSystemDefaultPaper()
PaperInfo::PaperInfo(Paper eType) : m_eType(eType)
{
+ OSL_ENSURE( sizeof(aDinTab) / sizeof(aDinTab[0]) == NUM_PAPER_ENTRIES,
+ "mismatch between array entries and enum values" );
+
m_nPaperWidth = aDinTab[m_eType].m_nWidth;
m_nPaperHeight = aDinTab[m_eType].m_nHeight;
}
diff --git a/l10ntools/source/filter/utils/Cache.java b/l10ntools/source/filter/utils/Cache.java
index f4120b2140cc..d1d4766398d2 100644
--- a/l10ntools/source/filter/utils/Cache.java
+++ b/l10ntools/source/filter/utils/Cache.java
@@ -159,7 +159,6 @@ public class Cache
private static final java.lang.String FLAGNAME_PACKED = "PACKED";
private static final java.lang.String FLAGNAME_PREFERRED = "PREFERRED";
private static final java.lang.String FLAGNAME_READONLY = "READONLY";
- private static final java.lang.String FLAGNAME_SILENTEXPORT = "SILENTEXPORT";
private static final java.lang.String FLAGNAME_TEMPLATE = "TEMPLATE";
private static final java.lang.String FLAGNAME_TEMPLATEPATH = "TEMPLATEPATH";
private static final java.lang.String FLAGNAME_USESOPTIONS = "USESOPTIONS";
@@ -185,7 +184,6 @@ public class Cache
private static final int FLAGVAL_PACKED = 0x00100000; // 1048576
private static final int FLAGVAL_PREFERRED = 0x10000000; // 268435456
private static final int FLAGVAL_READONLY = 0x00010000; // 65536
- private static final int FLAGVAL_SILENTEXPORT = 0x00200000; // 2097152
private static final int FLAGVAL_TEMPLATE = 0x00000004; // 4
private static final int FLAGVAL_TEMPLATEPATH = 0x00000010; // 16
private static final int FLAGVAL_USESOPTIONS = 0x00000080; // 128
@@ -1358,9 +1356,6 @@ public class Cache
if (sFlagName.equals(FLAGNAME_READONLY))
nFlags |= FLAGVAL_READONLY;
else
- if (sFlagName.equals(FLAGNAME_SILENTEXPORT))
- nFlags |= FLAGVAL_SILENTEXPORT;
- else
if (sFlagName.equals(FLAGNAME_TEMPLATE))
nFlags |= FLAGVAL_TEMPLATE;
else
@@ -1455,9 +1450,6 @@ public class Cache
if((field & FLAGVAL_PACKED) == FLAGVAL_PACKED)
lFlags.add(FLAGNAME_PACKED);
- if((field & FLAGVAL_SILENTEXPORT) == FLAGVAL_SILENTEXPORT)
- lFlags.add(FLAGNAME_SILENTEXPORT);
-
if((field & FLAGVAL_BROWSERPREFERRED) == FLAGVAL_BROWSERPREFERRED)
lFlags.add(FLAGNAME_BROWSERPREFERRED);
diff --git a/svl/inc/svl/undo.hxx b/svl/inc/svl/undo.hxx
index 5aea03207626..08d2fa6c5b84 100644
--- a/svl/inc/svl/undo.hxx
+++ b/svl/inc/svl/undo.hxx
@@ -32,6 +32,10 @@
#include <tools/string.hxx>
#include <svl/svarray.hxx>
+#include <boost/scoped_ptr.hpp>
+
+#include <vector>
+
//====================================================================
class SVL_DLLPUBLIC SfxRepeatTarget
@@ -43,6 +47,14 @@ public:
//====================================================================
+class SVL_DLLPUBLIC SfxUndoContext
+{
+public:
+ virtual ~SfxUndoContext() = 0;
+};
+
+//====================================================================
+
class SVL_DLLPUBLIC SfxUndoAction
{
BOOL bLinked;
@@ -54,14 +66,16 @@ public:
virtual BOOL IsLinked();
virtual void SetLinked( BOOL bIsLinked = TRUE );
virtual void Undo();
+ virtual void UndoWithContext( SfxUndoContext& i_context );
virtual void Redo();
+ virtual void RedoWithContext( SfxUndoContext& i_context );
virtual void Repeat(SfxRepeatTarget&);
virtual BOOL CanRepeat(SfxRepeatTarget&) const;
virtual BOOL Merge( SfxUndoAction *pNextAction );
- virtual UniString GetComment() const;
- virtual UniString GetRepeatComment(SfxRepeatTarget&) const;
+ virtual UniString GetComment() const;
+ virtual UniString GetRepeatComment(SfxRepeatTarget&) const;
virtual USHORT GetId() const;
private:
@@ -70,19 +84,67 @@ private:
//========================================================================
-SV_DECL_PTRARR( SfxUndoActions, SfxUndoAction*, 20, 8 )
+/// 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 this implementation details, unless you
+/** do not make use of these implementation details, unless you
really really have to! */
struct SVL_DLLPUBLIC SfxUndoArray
{
SfxUndoActions aUndoActions;
- USHORT nMaxUndoActions;
- USHORT nCurUndoAction;
+ size_t nMaxUndoActions;
+ size_t nCurUndoAction;
SfxUndoArray *pFatherUndoArray;
- SfxUndoArray(USHORT nMax=0):
+ SfxUndoArray(size_t nMax=0):
nMaxUndoActions(nMax), nCurUndoAction(0),
pFatherUndoArray(0) {}
~SfxUndoArray();
@@ -90,7 +152,7 @@ struct SVL_DLLPUBLIC SfxUndoArray
//=========================================================================
-/** do not make use of this implementation details, unless you
+/** do not make use of these implementation details, unless you
really really have to! */
class SVL_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArray
@@ -111,14 +173,16 @@ class SVL_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArra
SfxListUndoAction( const UniString &rComment,
const UniString rRepeatComment, USHORT 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 BOOL CanRepeat(SfxRepeatTarget&) const;
virtual BOOL Merge( SfxUndoAction *pNextAction );
- virtual UniString GetComment() const;
- virtual UniString GetRepeatComment(SfxRepeatTarget&) const;
+ virtual UniString GetComment() const;
+ virtual UniString GetRepeatComment(SfxRepeatTarget&) const;
virtual USHORT GetId() const;
void SetComment( const UniString& rComment );
@@ -126,70 +190,242 @@ class SVL_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArra
private:
USHORT nId;
- UniString aComment, aRepeatComment;
+ UniString aComment;
+ UniString aRepeatComment;
};
//=========================================================================
-class SVL_DLLPUBLIC SfxUndoManager
+/** is a callback interface for notifications about state changes of an SfxUndoManager
+*/
+class SAL_NO_VTABLE SfxUndoListener
{
- friend class SfxLinkUndoAction;
+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;
+};
- SfxUndoArray *pUndoArray;
- SfxUndoArray *pActUndoArray;
- SfxUndoArray *pFatherUndoArray;
+//=========================================================================
- bool mbUndoEnabled;
-public:
- SfxUndoManager( USHORT nMaxUndoActionCount = 20 );
- virtual ~SfxUndoManager();
+namespace svl
+{
+ class SAL_NO_VTABLE IUndoManager
+ {
+ public:
+ enum
+ {
+ CurrentLevel = true,
+ TopLevel = false
+ };
- virtual void SetMaxUndoActionCount( USHORT nMaxUndoActionCount );
- virtual USHORT GetMaxUndoActionCount() const;
- virtual void Clear();
+ virtual ~IUndoManager() { };
- virtual void AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg=FALSE );
+ virtual void SetMaxUndoActionCount( size_t nMaxUndoActionCount ) = 0;
+ virtual size_t GetMaxUndoActionCount() const = 0;
- virtual USHORT GetUndoActionCount() const;
- virtual USHORT GetUndoActionId(USHORT nNo=0) const;
- virtual UniString GetUndoActionComment( USHORT nNo=0 ) const;
- /** returns the nNo'th undo action from the top */
- SfxUndoAction* GetUndoAction( USHORT nNo=0 ) const;
+ virtual void AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg=FALSE ) = 0;
- virtual BOOL Undo( USHORT nCount=1 );
- virtual void Undo( SfxUndoAction &rAction );
+ virtual size_t GetUndoActionCount( bool const i_currentLevel = CurrentLevel ) const = 0;
+ virtual USHORT GetUndoActionId() const = 0;
+ virtual UniString GetUndoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const = 0;
+ virtual SfxUndoAction* GetUndoAction( size_t nNo=0 ) const = 0;
- virtual USHORT GetRedoActionCount() const;
- virtual USHORT GetRedoActionId(USHORT nNo=0) const;
- virtual UniString GetRedoActionComment( USHORT nNo=0 ) const;
+ virtual size_t GetRedoActionCount( bool const i_currentLevel = CurrentLevel ) const = 0;
+ virtual UniString GetRedoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const = 0;
- virtual BOOL Redo( USHORT nCount=1 );
- virtual void Redo( SfxUndoAction &rAction );
- virtual void ClearRedo();
+ virtual BOOL Undo() = 0;
+ virtual 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.
- virtual USHORT GetRepeatActionCount() const;
- virtual UniString GetRepeatActionComment( SfxRepeatTarget &rTarget, USHORT nNo = 0) const;
- virtual BOOL Repeat( SfxRepeatTarget &rTarget, USHORT nFrom=0, USHORT nCount=1 );
- virtual void Repeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction );
- virtual BOOL CanRepeat( SfxRepeatTarget &rTarget, USHORT nNo = 0 ) const;
- virtual BOOL CanRepeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction ) const;
+ 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
+ atomar 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 UniString GetRepeatActionComment( SfxRepeatTarget &rTarget) const = 0;
+ virtual BOOL Repeat( SfxRepeatTarget &rTarget ) = 0;
+ virtual BOOL CanRepeat( SfxRepeatTarget &rTarget ) const = 0;
+
+ virtual void EnterListAction(const UniString &rComment, const UniString& rRepeatComment, USHORT 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!
+ 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, BOOL bTryMerg=FALSE );
+ virtual size_t GetUndoActionCount( bool const i_currentLevel = CurrentLevel ) const;
+ virtual USHORT GetUndoActionId() const;
+ virtual UniString 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 UniString GetRedoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const;
+ virtual BOOL Undo();
+ virtual BOOL Redo();
+ virtual void Clear();
+ virtual void ClearRedo();
+ virtual void Reset();
+ virtual bool IsDoing() const;
+ virtual size_t GetRepeatActionCount() const;
+ virtual UniString GetRepeatActionComment( SfxRepeatTarget &rTarget) const;
+ virtual BOOL Repeat( SfxRepeatTarget &rTarget );
+ virtual BOOL CanRepeat( SfxRepeatTarget &rTarget ) const;
virtual void EnterListAction(const UniString &rComment, const UniString& rRepeatComment, USHORT nId=0);
- virtual void LeaveListAction();
+ 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:
+ BOOL UndoWithContext( SfxUndoContext& i_context );
+ BOOL RedoWithContext( SfxUndoContext& i_context );
+
+ void ImplClearRedo_NoLock( bool const i_currentLevel );
- /** clears the redo stack and removes the top undo action */
- void RemoveLastUndoAction();
+ /** clears all undo actions on the current level, plus all undo actions on superordinate levels,
+ as soon as those levels are reached.
- // enables (true) or disables (false) recording of undo actions
- // If undo actions are added while undo is disabled, they are deleted.
- // Disabling undo does not clear the current undo buffer!
- void EnableUndo( bool bEnable );
+ If no list action is active currently, i.e. we're on the top level already, this method is equivalent to
+ ->Clear.
- // returns true if undo is currently enabled
- // This returns false if undo was disabled using EnableUndo( false ) and
- // also during the runtime of the Undo() and Redo() methods.
- bool IsUndoEnabled() const { return mbUndoEnabled; }
+ 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 );
+
+ BOOL ImplUndo( SfxUndoContext* i_contextOrNull );
+ BOOL ImplRedo( SfxUndoContext* i_contextOrNull );
+
+ friend class ::svl::undo::impl::LockGuard;
};
//=========================================================================
@@ -213,7 +449,7 @@ class SVL_DLLPUBLIC SfxLinkUndoAction : public SfxUndoAction
{
public:
TYPEINFO();
- SfxLinkUndoAction(SfxUndoManager *pManager);
+ SfxLinkUndoAction(::svl::IUndoManager *pManager);
~SfxLinkUndoAction();
virtual void Undo();
@@ -222,14 +458,14 @@ public:
virtual void Repeat(SfxRepeatTarget&r);
- virtual UniString GetComment() const;
- virtual UniString GetRepeatComment(SfxRepeatTarget&r) const;
+ virtual UniString GetComment() const;
+ virtual UniString GetRepeatComment(SfxRepeatTarget&r) const;
virtual USHORT GetId() const;
SfxUndoAction* GetAction() const { return pAction; }
protected:
- SfxUndoManager *pUndoManager;
+ ::svl::IUndoManager *pUndoManager;
SfxUndoAction *pAction;
};
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index fa5eca964a8c..fd789e6a4aac 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -30,10 +30,16 @@
#include <com/sun/star/uno/Exception.hpp>
+#include <comphelper/flagguard.hxx>
#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
#include <svl/undo.hxx>
+#include <vector>
+#include <list>
+#include <limits>
+
using ::com::sun::star::uno::Exception;
// STATIC DATA -----------------------------------------------------------
@@ -55,6 +61,12 @@ SfxRepeatTarget::~SfxRepeatTarget()
//------------------------------------------------------------------------
+SfxUndoContext::~SfxUndoContext()
+{
+}
+
+//------------------------------------------------------------------------
+
BOOL SfxUndoAction::IsLinked()
{
return bLinked;
@@ -117,7 +129,6 @@ XubString SfxUndoAction::GetRepeatComment(SfxRepeatTarget&) const
//------------------------------------------------------------------------
-
void SfxUndoAction::Undo()
{
// die sind nur konzeptuell pure virtual
@@ -126,6 +137,14 @@ void SfxUndoAction::Undo()
//------------------------------------------------------------------------
+void SfxUndoAction::UndoWithContext( SfxUndoContext& i_context )
+{
+ (void)i_context;
+ Undo();
+}
+
+//------------------------------------------------------------------------
+
void SfxUndoAction::Redo()
{
// die sind nur konzeptuell pure virtual
@@ -134,6 +153,14 @@ void SfxUndoAction::Redo()
//------------------------------------------------------------------------
+void SfxUndoAction::RedoWithContext( SfxUndoContext& i_context )
+{
+ (void)i_context;
+ Redo();
+}
+
+//------------------------------------------------------------------------
+
void SfxUndoAction::Repeat(SfxRepeatTarget&)
{
// die sind nur konzeptuell pure virtual
@@ -150,206 +177,554 @@ BOOL SfxUndoAction::CanRepeat(SfxRepeatTarget&) const
//========================================================================
+typedef ::std::vector< SfxUndoListener* > UndoListeners;
+
+struct SVL_DLLPRIVATE SfxUndoManager_Data
+{
+ ::osl::Mutex aMutex;
+ SfxUndoArray* pUndoArray;
+ SfxUndoArray* pActUndoArray;
+ SfxUndoArray* pFatherUndoArray;
+
+ sal_Int32 mnLockCount;
+ sal_Int32 mnMarks;
+ sal_Int32 mnEmptyMark;
+ bool mbDoing;
+ bool mbClearUntilTopLevel;
+
+ UndoListeners aListeners;
+
+ SfxUndoManager_Data( size_t i_nMaxUndoActionCount )
+ :pUndoArray( new SfxUndoArray( i_nMaxUndoActionCount ) )
+ ,pActUndoArray( NULL )
+ ,pFatherUndoArray( NULL )
+ ,mnLockCount( 0 )
+ ,mnMarks( 0 )
+ ,mnEmptyMark(MARK_INVALID)
+ ,mbDoing( false )
+ ,mbClearUntilTopLevel( false )
+ {
+ pActUndoArray = pUndoArray;
+ }
+
+ ~SfxUndoManager_Data()
+ {
+ delete pUndoArray;
+ }
+};
+
+//========================================================================
-SfxUndoManager::SfxUndoManager( USHORT nMaxUndoActionCount )
- : pFatherUndoArray(0)
- , mbUndoEnabled( true )
+namespace svl { namespace undo { namespace impl
{
- pUndoArray=new SfxUndoArray(nMaxUndoActionCount);
- pActUndoArray=pUndoArray;
+ //--------------------------------------------------------------------
+ class SVL_DLLPRIVATE LockGuard
+ {
+ public:
+ LockGuard( SfxUndoManager& i_manager )
+ :m_manager( i_manager )
+ {
+ m_manager.ImplEnableUndo_Lock( false );
+ }
+
+ ~LockGuard()
+ {
+ m_manager.ImplEnableUndo_Lock( true );
+ }
+
+ private:
+ SfxUndoManager& m_manager;
+ };
+
+ //--------------------------------------------------------------------
+ typedef void ( SfxUndoListener::*UndoListenerVoidMethod )();
+ typedef void ( SfxUndoListener::*UndoListenerStringMethod )( const String& );
+
+ //--------------------------------------------------------------------
+ struct SVL_DLLPRIVATE NotifyUndoListener : public ::std::unary_function< SfxUndoListener*, void >
+ {
+ NotifyUndoListener()
+ :m_notificationMethod( NULL )
+ ,m_altNotificationMethod( NULL )
+ ,m_sActionComment()
+ {
+ }
+ NotifyUndoListener( UndoListenerVoidMethod i_notificationMethod )
+ :m_notificationMethod( i_notificationMethod )
+ ,m_altNotificationMethod( NULL )
+ ,m_sActionComment()
+ {
+ }
+
+ NotifyUndoListener( UndoListenerStringMethod i_notificationMethod, const String& i_actionComment )
+ :m_notificationMethod( NULL )
+ ,m_altNotificationMethod( i_notificationMethod )
+ ,m_sActionComment( i_actionComment )
+ {
+ }
+
+ bool is() const
+ {
+ return ( m_notificationMethod != NULL ) || ( m_altNotificationMethod != NULL );
+ }
+
+ void operator()( SfxUndoListener* i_listener ) const
+ {
+ OSL_PRECOND( is(), "NotifyUndoListener: this will crash!" );
+ if ( m_altNotificationMethod != NULL )
+ {
+ ( i_listener->*m_altNotificationMethod )( m_sActionComment );
+ }
+ else
+ {
+ ( i_listener->*m_notificationMethod )();
+ }
+ }
+
+ private:
+ UndoListenerVoidMethod m_notificationMethod;
+ UndoListenerStringMethod m_altNotificationMethod;
+ String m_sActionComment;
+ };
+
+ //--------------------------------------------------------------------
+ class SVL_DLLPRIVATE UndoManagerGuard
+ {
+ public:
+ UndoManagerGuard( SfxUndoManager_Data& i_managerData )
+ :m_rManagerData( i_managerData )
+ ,m_aGuard( i_managerData.aMutex )
+ ,m_notifiers()
+ {
+ }
+
+ ~UndoManagerGuard();
+
+ void clear()
+ {
+ m_aGuard.clear();
+ }
+
+ void reset()
+ {
+ m_aGuard.reset();
+ }
+
+ void cancelNotifications()
+ {
+ m_notifiers.clear();
+ }
+
+ /** marks the given Undo action for deletion
+
+ The Undo action will be put into a list, whose members will be deleted from within the destructor of the
+ UndoManagerGuard. This deletion will happen without the UndoManager's mutex locked.
+ */
+ void markForDeletion( SfxUndoAction* i_action )
+ {
+ // remember
+ if ( i_action )
+ m_aUndoActionsCleanup.push_back( i_action );
+ }
+
+ /** schedules the given SfxUndoListener method to be called for all registered listeners.
+
+ The notification will happen after the Undo manager's mutex has been released, and after all pending
+ deletions of Undo actions are done.
+ */
+ void scheduleNotification( UndoListenerVoidMethod i_notificationMethod )
+ {
+ m_notifiers.push_back( NotifyUndoListener( i_notificationMethod ) );
+ }
+
+ void scheduleNotification( UndoListenerStringMethod i_notificationMethod, const String& i_actionComment )
+ {
+ m_notifiers.push_back( NotifyUndoListener( i_notificationMethod, i_actionComment ) );
+ }
+
+ private:
+ SfxUndoManager_Data& m_rManagerData;
+ ::osl::ResettableMutexGuard m_aGuard;
+ ::std::list< SfxUndoAction* > m_aUndoActionsCleanup;
+ ::std::list< NotifyUndoListener > m_notifiers;
+ };
+
+ UndoManagerGuard::~UndoManagerGuard()
+ {
+ // copy members
+ UndoListeners aListenersCopy( m_rManagerData.aListeners );
+
+ // release mutex
+ m_aGuard.clear();
+
+ // delete all actions
+ while ( !m_aUndoActionsCleanup.empty() )
+ {
+ SfxUndoAction* pAction = m_aUndoActionsCleanup.front();
+ m_aUndoActionsCleanup.pop_front();
+ try
+ {
+ delete pAction;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ // handle scheduled notification
+ for ( ::std::list< NotifyUndoListener >::const_iterator notifier = m_notifiers.begin();
+ notifier != m_notifiers.end();
+ ++notifier
+ )
+ {
+ if ( notifier->is() )
+ ::std::for_each( aListenersCopy.begin(), aListenersCopy.end(), *notifier );
+ }
+ }
+} } }
+
+using namespace ::svl::undo::impl;
+
+//========================================================================
+
+SfxUndoManager::SfxUndoManager( size_t nMaxUndoActionCount )
+ :m_pData( new SfxUndoManager_Data( nMaxUndoActionCount ) )
+{
}
//------------------------------------------------------------------------
-
SfxUndoManager::~SfxUndoManager()
{
- delete pUndoArray;
+ UndoListeners aListenersCopy;
+ {
+ UndoManagerGuard aGuard( *m_pData );
+ aListenersCopy = m_pData->aListeners;
+ }
+
+ ::std::for_each( aListenersCopy.begin(), aListenersCopy.end(),
+ NotifyUndoListener( &SfxUndoListener::undoManagerDying ) );
}
//------------------------------------------------------------------------
-void SfxUndoManager::EnableUndo( bool bEnable )
+void SfxUndoManager::EnableUndo( bool i_enable )
{
- mbUndoEnabled = bEnable;
+ UndoManagerGuard aGuard( *m_pData );
+ ImplEnableUndo_Lock( i_enable );
+
}
//------------------------------------------------------------------------
+void SfxUndoManager::ImplEnableUndo_Lock( bool const i_enable )
+{
+ if ( !i_enable )
+ ++m_pData->mnLockCount;
+ else
+ {
+ OSL_PRECOND( m_pData->mnLockCount > 0, "SfxUndoManager::ImplEnableUndo_NoNotify: not disabled, so why enabling?" );
+ if ( m_pData->mnLockCount > 0 )
+ --m_pData->mnLockCount;
+ }
+}
-void SfxUndoManager::SetMaxUndoActionCount( USHORT nMaxUndoActionCount )
+//------------------------------------------------------------------------
+
+bool SfxUndoManager::IsUndoEnabled() const
{
+ UndoManagerGuard aGuard( *m_pData );
+ return ImplIsUndoEnabled_Lock();
+}
+
+//------------------------------------------------------------------------
+
+bool SfxUndoManager::ImplIsUndoEnabled_Lock() const
+{
+ return m_pData->mnLockCount == 0;
+}
+
+//------------------------------------------------------------------------
+
+void SfxUndoManager::SetMaxUndoActionCount( size_t nMaxUndoActionCount )
+{
+ UndoManagerGuard aGuard( *m_pData );
+
// Remove entries from the pActUndoArray when we have to reduce
// the number of entries due to a lower nMaxUndoActionCount.
// Both redo and undo action entries will be removed until we reached the
// new nMaxUndoActionCount.
- long nNumToDelete = pActUndoArray->aUndoActions.Count() - nMaxUndoActionCount;
- if ( nNumToDelete > 0 )
+ long nNumToDelete = m_pData->pActUndoArray->aUndoActions.size() - nMaxUndoActionCount;
+ while ( nNumToDelete > 0 )
{
- while ( nNumToDelete > 0 )
+ size_t nPos = m_pData->pActUndoArray->aUndoActions.size();
+ if ( nPos > m_pData->pActUndoArray->nCurUndoAction )
{
- USHORT nPos = pActUndoArray->aUndoActions.Count();
- if ( nPos > pActUndoArray->nCurUndoAction )
+ SfxUndoAction* pAction = m_pData->pActUndoArray->aUndoActions[nPos-1].pAction;
+ if ( !pAction->IsLinked() )
{
- if ( !pActUndoArray->aUndoActions[nPos-1]->IsLinked() )
- {
- delete pActUndoArray->aUndoActions[nPos-1];
- pActUndoArray->aUndoActions.Remove( nPos-1 );
- --nNumToDelete;
- }
+ aGuard.markForDeletion( pAction );
+ m_pData->pActUndoArray->aUndoActions.Remove( nPos-1 );
+ --nNumToDelete;
}
+ }
- if ( nNumToDelete > 0 && pActUndoArray->nCurUndoAction > 0 )
+ if ( nNumToDelete > 0 && m_pData->pActUndoArray->nCurUndoAction > 0 )
+ {
+ SfxUndoAction* pAction = m_pData->pActUndoArray->aUndoActions[0].pAction;
+ if ( !pAction->IsLinked() )
{
- if ( !pActUndoArray->aUndoActions[0]->IsLinked() )
- {
- delete pActUndoArray->aUndoActions[0];
- pActUndoArray->aUndoActions.Remove(0);
- --pActUndoArray->nCurUndoAction;
- --nNumToDelete;
- }
+ aGuard.markForDeletion( pAction );
+ m_pData->pActUndoArray->aUndoActions.Remove(0);
+ --m_pData->pActUndoArray->nCurUndoAction;
+ --nNumToDelete;
}
-
- if ( nPos == pActUndoArray->aUndoActions.Count() )
- break; // Cannot delete more entries
}
+
+ if ( nPos == m_pData->pActUndoArray->aUndoActions.size() )
+ break; // Cannot delete more entries
}
- pActUndoArray->nMaxUndoActions = nMaxUndoActionCount;
+ m_pData->pActUndoArray->nMaxUndoActions = nMaxUndoActionCount;
}
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetMaxUndoActionCount() const
+size_t SfxUndoManager::GetMaxUndoActionCount() const
{
- return pActUndoArray->nMaxUndoActions;
+ UndoManagerGuard aGuard( *m_pData );
+ return m_pData->pActUndoArray->nMaxUndoActions;
}
//------------------------------------------------------------------------
-void SfxUndoManager::Clear()
+void SfxUndoManager::ImplClearCurrentLevel_NoNotify( UndoManagerGuard& i_guard )
{
- while ( pActUndoArray->aUndoActions.Count() )
+ // clear array
+ while ( !m_pData->pActUndoArray->aUndoActions.empty() )
{
- SfxUndoAction *pAction=
- pActUndoArray->aUndoActions[pActUndoArray->aUndoActions.Count() - 1];
- pActUndoArray->aUndoActions.Remove( pActUndoArray->aUndoActions.Count() - 1 );
- delete pAction;
+ size_t deletePos = m_pData->pActUndoArray->aUndoActions.size() - 1;
+ SfxUndoAction* pAction = m_pData->pActUndoArray->aUndoActions[ deletePos ].pAction;
+ i_guard.markForDeletion( pAction );
+ m_pData->pActUndoArray->aUndoActions.Remove( deletePos );
}
- pActUndoArray->nCurUndoAction = 0;
+ m_pData->pActUndoArray->nCurUndoAction = 0;
+
+ m_pData->mnMarks = 0;
+ m_pData->mnEmptyMark = MARK_INVALID;
}
//------------------------------------------------------------------------
-void SfxUndoManager::ClearRedo()
+void SfxUndoManager::Clear()
{
- while ( pActUndoArray->aUndoActions.Count() > pActUndoArray->nCurUndoAction )
- {
- SfxUndoAction *pAction=
- pActUndoArray->aUndoActions[pActUndoArray->aUndoActions.Count() - 1];
- pActUndoArray->aUndoActions.Remove( pActUndoArray->aUndoActions.Count() - 1 );
- delete pAction;
- }
+ UndoManagerGuard aGuard( *m_pData );
+
+ OSL_ENSURE( !ImplIsInListAction_Lock(), "SfxUndoManager::Clear: suspicious call - do you really wish to clear the current level?" );
+ ImplClearCurrentLevel_NoNotify( aGuard );
+
+ // notify listeners
+ aGuard.scheduleNotification( &SfxUndoListener::cleared );
}
//------------------------------------------------------------------------
-void SfxUndoManager::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerge )
+void SfxUndoManager::ClearAllLevels()
{
- if( mbUndoEnabled )
+ UndoManagerGuard aGuard( *m_pData );
+ ImplClearCurrentLevel_NoNotify( aGuard );
+
+ if ( ImplIsInListAction_Lock() )
+ {
+ m_pData->mbClearUntilTopLevel = true;
+ }
+ else
{
- // Redo-Actions loeschen
- for ( USHORT nPos = pActUndoArray->aUndoActions.Count();
- nPos > pActUndoArray->nCurUndoAction; --nPos )
- delete pActUndoArray->aUndoActions[nPos-1];
+ aGuard.scheduleNotification( &SfxUndoListener::cleared );
+ }
+}
- pActUndoArray->aUndoActions.Remove(
- pActUndoArray->nCurUndoAction,
- pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction );
+//------------------------------------------------------------------------
- if ( pActUndoArray->nMaxUndoActions )
- {
- SfxUndoAction *pTmpAction = pActUndoArray->nCurUndoAction ?
- pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1] : 0;
+void SfxUndoManager::ImplClearRedo_NoLock( bool const i_currentLevel )
+{
+ UndoManagerGuard aGuard( *m_pData );
+ ImplClearRedo( aGuard, i_currentLevel );
+}
- if ( !bTryMerge || !(pTmpAction && pTmpAction->Merge(pAction)) )
- {
- // auf Max-Anzahl anpassen
- if( pActUndoArray == pUndoArray )
- while( pActUndoArray->aUndoActions.Count() >=
- pActUndoArray->nMaxUndoActions &&
- !pActUndoArray->aUndoActions[0]->IsLinked() )
- {
- delete pActUndoArray->aUndoActions[0];
- pActUndoArray->aUndoActions.Remove(0);
- --pActUndoArray->nCurUndoAction;
- }
-
- // neue Action anh"angen
- const SfxUndoAction* pTemp = pAction;
- pActUndoArray->aUndoActions.Insert(
- pTemp, pActUndoArray->nCurUndoAction++ );
- return;
- }
- }
- }
- delete pAction;
+//------------------------------------------------------------------------
+
+void SfxUndoManager::ClearRedo()
+{
+ OSL_ENSURE( !IsInListAction(), "SfxUndoManager::ClearRedo: suspicious call - do you really wish to clear the current level?" );
+ ImplClearRedo_NoLock( CurrentLevel );
}
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetUndoActionCount() const
+void SfxUndoManager::Reset()
{
- return pActUndoArray->nCurUndoAction;
+ UndoManagerGuard aGuard( *m_pData );
+
+ // clear all locks
+ while ( !ImplIsUndoEnabled_Lock() )
+ ImplEnableUndo_Lock( true );
+
+ // cancel all list actions
+ while ( IsInListAction() )
+ ImplLeaveListAction( false, aGuard );
+
+ // clear both stacks
+ ImplClearCurrentLevel_NoNotify( aGuard );
+
+ // cancel the notifications scheduled by ImplLeaveListAction,
+ // as we want to do an own, dedicated notification
+ aGuard.cancelNotifications();
+
+ // schedule notification
+ aGuard.scheduleNotification( &SfxUndoListener::resetAll );
}
//------------------------------------------------------------------------
-XubString SfxUndoManager::GetUndoActionComment( USHORT nNo ) const
+void SfxUndoManager::ImplClearUndo( UndoManagerGuard& i_guard )
{
- DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoActionComment(), illegal id!" );
- if( nNo < pActUndoArray->nCurUndoAction )
+ while ( m_pData->pActUndoArray->nCurUndoAction > 0 )
{
- return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetComment(); //!
+ SfxUndoAction* pUndoAction = m_pData->pActUndoArray->aUndoActions[0].pAction;
+ m_pData->pActUndoArray->aUndoActions.Remove( 0 );
+ i_guard.markForDeletion( pUndoAction );
+ --m_pData->pActUndoArray->nCurUndoAction;
}
- else
+ // TODO: notifications? We don't have clearedUndo, only cleared and clearedRedo at the SfxUndoListener
+}
+
+//------------------------------------------------------------------------
+
+void SfxUndoManager::ImplClearRedo( UndoManagerGuard& i_guard, bool const i_currentLevel )
+{
+ SfxUndoArray* pUndoArray = ( i_currentLevel == IUndoManager::CurrentLevel ) ? m_pData->pActUndoArray : m_pData->pUndoArray;
+
+ // clearance
+ while ( pUndoArray->aUndoActions.size() > pUndoArray->nCurUndoAction )
{
- XubString aEmpty;
- return aEmpty;
+ size_t deletePos = pUndoArray->aUndoActions.size() - 1;
+ SfxUndoAction* pAction = pUndoArray->aUndoActions[ deletePos ].pAction;
+ pUndoArray->aUndoActions.Remove( deletePos );
+ i_guard.markForDeletion( pAction );
}
+
+ // notification - only if the top level's stack was cleared
+ if ( i_currentLevel == IUndoManager::TopLevel )
+ i_guard.scheduleNotification( &SfxUndoListener::clearedRedo );
}
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetUndoActionId( USHORT nNo ) const
+bool SfxUndoManager::ImplAddUndoAction_NoNotify( SfxUndoAction *pAction, bool bTryMerge, bool bClearRedo, UndoManagerGuard& i_guard )
{
- DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoActionId(), illegal id!" );
- if( nNo < pActUndoArray->nCurUndoAction )
+ if ( !ImplIsUndoEnabled_Lock() || ( m_pData->pActUndoArray->nMaxUndoActions == 0 ) )
{
- return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetId(); //!
+ i_guard.markForDeletion( pAction );
+ return false;
}
- else
+
+ // merge, if required
+ SfxUndoAction* pMergeWithAction = m_pData->pActUndoArray->nCurUndoAction ?
+ m_pData->pActUndoArray->aUndoActions[m_pData->pActUndoArray->nCurUndoAction-1].pAction : NULL;
+ if ( bTryMerge && ( !pMergeWithAction || !pMergeWithAction->Merge( pAction ) ) )
{
- return 0;
+ i_guard.markForDeletion( pAction );
+ return false;
}
+
+ // clear redo stack, if requested
+ if ( bClearRedo && ( ImplGetRedoActionCount_Lock( CurrentLevel ) > 0 ) )
+ ImplClearRedo( i_guard, IUndoManager::CurrentLevel );
+
+ // respect max number
+ if( m_pData->pActUndoArray == m_pData->pUndoArray )
+ {
+ while( m_pData->pActUndoArray->aUndoActions.size() >=
+ m_pData->pActUndoArray->nMaxUndoActions &&
+ !m_pData->pActUndoArray->aUndoActions[0].pAction->IsLinked() )
+ {
+ i_guard.markForDeletion( m_pData->pActUndoArray->aUndoActions[0].pAction );
+ m_pData->pActUndoArray->aUndoActions.Remove(0);
+ --m_pData->pActUndoArray->nCurUndoAction;
+ }
+ }
+
+ // append new action
+ m_pData->pActUndoArray->aUndoActions.Insert( pAction, m_pData->pActUndoArray->nCurUndoAction++ );
+ return true;
}
//------------------------------------------------------------------------
-SfxUndoAction* SfxUndoManager::GetUndoAction( USHORT nNo ) const
+void SfxUndoManager::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerge )
{
- DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoAction(), illegal id!" );
- if( nNo < pActUndoArray->nCurUndoAction )
+ UndoManagerGuard aGuard( *m_pData );
+
+ // add
+ if ( ImplAddUndoAction_NoNotify( pAction, bTryMerge, true, aGuard ) )
{
- return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]; //!
+ // notify listeners
+ aGuard.scheduleNotification( &SfxUndoListener::undoActionAdded, pAction->GetComment() );
}
- else
+}
+
+//------------------------------------------------------------------------
+
+size_t SfxUndoManager::GetUndoActionCount( bool const i_currentLevel ) const
+{
+ UndoManagerGuard aGuard( *m_pData );
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
+ return pUndoArray->nCurUndoAction;
+}
+
+//------------------------------------------------------------------------
+
+XubString SfxUndoManager::GetUndoActionComment( size_t nNo, bool const i_currentLevel ) const
+{
+ UndoManagerGuard aGuard( *m_pData );
+
+ String sComment;
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
+ DBG_ASSERT( nNo < pUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoActionComment: illegal index!" );
+ if( nNo < pUndoArray->nCurUndoAction )
{
- return 0;
+ sComment = pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction - 1 - nNo ].pAction->GetComment();
}
+ return sComment;
+}
+
+//------------------------------------------------------------------------
+
+USHORT SfxUndoManager::GetUndoActionId() const
+{
+ UndoManagerGuard aGuard( *m_pData );
+
+ DBG_ASSERT( m_pData->pActUndoArray->nCurUndoAction > 0, "svl::SfxUndoManager::GetUndoActionId(), illegal id!" );
+ if ( m_pData->pActUndoArray->nCurUndoAction == 0 )
+ return NULL;
+ return m_pData->pActUndoArray->aUndoActions[m_pData->pActUndoArray->nCurUndoAction-1].pAction->GetId();
+}
+
+//------------------------------------------------------------------------
+
+SfxUndoAction* SfxUndoManager::GetUndoAction( size_t nNo ) const
+{
+ UndoManagerGuard aGuard( *m_pData );
+
+ DBG_ASSERT( nNo < m_pData->pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoAction(), illegal id!" );
+ if( nNo >= m_pData->pActUndoArray->nCurUndoAction )
+ return NULL;
+ return m_pData->pActUndoArray->aUndoActions[m_pData->pActUndoArray->nCurUndoAction-1-nNo].pAction;
}
//------------------------------------------------------------------------
@@ -357,158 +732,235 @@ SfxUndoAction* SfxUndoManager::GetUndoAction( USHORT nNo ) const
/** clears the redo stack and removes the top undo action */
void SfxUndoManager::RemoveLastUndoAction()
{
- DBG_ASSERT( pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::RemoveLastUndoAction(), no action to remove?!" );
- if( pActUndoArray->nCurUndoAction )
- {
- pActUndoArray->nCurUndoAction--;
+ UndoManagerGuard aGuard( *m_pData );
- // delete redo-actions and top action
- USHORT nPos;
- for ( nPos = pActUndoArray->aUndoActions.Count(); nPos > pActUndoArray->nCurUndoAction; --nPos )
- delete pActUndoArray->aUndoActions[nPos-1];
+ ENSURE_OR_RETURN_VOID( m_pData->pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::RemoveLastUndoAction(), no action to remove?!" );
- pActUndoArray->aUndoActions.Remove(
- pActUndoArray->nCurUndoAction,
- pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction );
+ m_pData->pActUndoArray->nCurUndoAction--;
+
+ // delete redo-actions and top action
+ for ( size_t nPos = m_pData->pActUndoArray->aUndoActions.size(); nPos > m_pData->pActUndoArray->nCurUndoAction; --nPos )
+ {
+ aGuard.markForDeletion( m_pData->pActUndoArray->aUndoActions[nPos-1].pAction );
}
+
+ m_pData->pActUndoArray->aUndoActions.Remove(
+ m_pData->pActUndoArray->nCurUndoAction,
+ m_pData->pActUndoArray->aUndoActions.size() - m_pData->pActUndoArray->nCurUndoAction );
}
//------------------------------------------------------------------------
-BOOL SfxUndoManager::Undo( USHORT )
+bool SfxUndoManager::IsDoing() const
{
- bool bUndoWasEnabled = mbUndoEnabled;
- mbUndoEnabled = false;
+ UndoManagerGuard aGuard( *m_pData );
+ return m_pData->mbDoing;
+}
- BOOL bRet = FALSE;
+//------------------------------------------------------------------------
- try
- {
- DBG_ASSERT( pActUndoArray == pUndoArray, "svl::SfxUndoManager::Undo(), LeaveListAction() not yet called!" );
- if ( pActUndoArray->nCurUndoAction )
- {
- Undo( *pActUndoArray->aUndoActions[ --pActUndoArray->nCurUndoAction ] );
- bRet = TRUE;
- }
- }
- catch( Exception& e )
- {
- mbUndoEnabled = bUndoWasEnabled;
- throw e;
- }
- mbUndoEnabled = bUndoWasEnabled;
- return bRet;
+BOOL SfxUndoManager::Undo()
+{
+ return ImplUndo( NULL );
+}
+
+//------------------------------------------------------------------------
+
+BOOL SfxUndoManager::UndoWithContext( SfxUndoContext& i_context )
+{
+ return ImplUndo( &i_context );
}
//------------------------------------------------------------------------
-void SfxUndoManager::Undo( SfxUndoAction &rAction )
+BOOL SfxUndoManager::ImplUndo( SfxUndoContext* i_contextOrNull )
{
- bool bUndoWasEnabled = mbUndoEnabled;
- mbUndoEnabled = false;
+ UndoManagerGuard aGuard( *m_pData );
+ OSL_ENSURE( !IsDoing(), "SfxUndoManager::Undo: *nested* Undo/Redo actions? How this?" );
+
+ ::comphelper::FlagGuard aDoingGuard( m_pData->mbDoing );
+ LockGuard aLockGuard( *this );
+
+ if ( ImplIsInListAction_Lock() )
+ {
+ OSL_ENSURE( false, "SfxUndoManager::Undo: not possible when within a list action!" );
+ return FALSE;
+ }
+
+ if ( m_pData->pActUndoArray->nCurUndoAction == 0 )
+ {
+ OSL_ENSURE( false, "SfxUndoManager::Undo: undo stack is empty!" );
+ return FALSE;
+ }
+
+ SfxUndoAction* pAction = m_pData->pActUndoArray->aUndoActions[ --m_pData->pActUndoArray->nCurUndoAction ].pAction;
+ const String sActionComment = pAction->GetComment();
try
{
- rAction.Undo();
+ // clear the guard/mutex before calling into the SfxUndoAction - this can be an extension-implemented UNO component
+ // nowadays ...
+ aGuard.clear();
+ if ( i_contextOrNull != NULL )
+ pAction->UndoWithContext( *i_contextOrNull );
+ else
+ pAction->Undo();
+ aGuard.reset();
}
- catch( Exception& e )
+ catch( ... )
{
- mbUndoEnabled = bUndoWasEnabled;
- throw e;
+ aGuard.reset();
+
+ // in theory, somebody might have tampered with all of *m_pData while the mutex was unlocked. So, see if
+ // we still find pAction in our current Undo array
+ size_t nCurAction = 0;
+ while ( nCurAction < m_pData->pActUndoArray->aUndoActions.size() )
+ {
+ if ( m_pData->pActUndoArray->aUndoActions[ nCurAction++ ].pAction == pAction )
+ {
+ // the Undo action is still there ...
+ // assume the error is a permanent failure, and clear the Undo stack
+ ImplClearUndo( aGuard );
+ throw;
+ }
+ }
+ OSL_ENSURE( false, "SfxUndoManager::Undo: can't clear the Undo stack after the failure - some other party was faster ..." );
+ throw;
}
- mbUndoEnabled = bUndoWasEnabled;
+ aGuard.scheduleNotification( &SfxUndoListener::actionUndone, sActionComment );
+
+ return TRUE;
}
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetRedoActionCount() const
+size_t SfxUndoManager::GetRedoActionCount( bool const i_currentLevel ) const
{
- return pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction; //!
+ UndoManagerGuard aGuard( *m_pData );
+ return ImplGetRedoActionCount_Lock( i_currentLevel );
}
//------------------------------------------------------------------------
-XubString SfxUndoManager::GetRedoActionComment( USHORT nNo ) const
+size_t SfxUndoManager::ImplGetRedoActionCount_Lock( bool const i_currentLevel ) const
{
- return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction+nNo]->GetComment(); //!
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
+ return pUndoArray->aUndoActions.size() - pUndoArray->nCurUndoAction;
}
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetRedoActionId( USHORT nNo ) const
+XubString SfxUndoManager::GetRedoActionComment( size_t nNo, bool const i_currentLevel ) const
{
- return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction+nNo]->GetId(); //!
+ UndoManagerGuard aGuard( *m_pData );
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
+ return pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction + nNo ].pAction->GetComment();
}
//------------------------------------------------------------------------
-BOOL SfxUndoManager::Redo( USHORT )
+BOOL SfxUndoManager::Redo()
{
- bool bUndoWasEnabled = mbUndoEnabled;
- mbUndoEnabled = false;
-
- BOOL bRet = FALSE;
+ return ImplRedo( NULL );
+}
- try
- {
- if ( pActUndoArray->aUndoActions.Count() > pActUndoArray->nCurUndoAction )
- {
- Redo( *pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction++] );
- bRet = TRUE;
- }
- }
- catch( Exception& e )
- {
- mbUndoEnabled = bUndoWasEnabled;
- throw e;
- }
+//------------------------------------------------------------------------
- mbUndoEnabled = bUndoWasEnabled;
- return bRet;
+BOOL SfxUndoManager::RedoWithContext( SfxUndoContext& i_context )
+{
+ return ImplRedo( &i_context );
}
//------------------------------------------------------------------------
-void SfxUndoManager::Redo( SfxUndoAction &rAction )
+BOOL SfxUndoManager::ImplRedo( SfxUndoContext* i_contextOrNull )
{
- bool bUndoWasEnabled = mbUndoEnabled;
- mbUndoEnabled = false;
+ UndoManagerGuard aGuard( *m_pData );
+ OSL_ENSURE( !IsDoing(), "SfxUndoManager::Redo: *nested* Undo/Redo actions? How this?" );
+ ::comphelper::FlagGuard aDoingGuard( m_pData->mbDoing );
+ LockGuard aLockGuard( *this );
+
+ if ( ImplIsInListAction_Lock() )
+ {
+ OSL_ENSURE( false, "SfxUndoManager::Redo: not possible when within a list action!" );
+ return FALSE;
+ }
+
+ if ( m_pData->pActUndoArray->nCurUndoAction >= m_pData->pActUndoArray->aUndoActions.size() )
+ {
+ OSL_ENSURE( false, "SfxUndoManager::Redo: redo stack is empty!" );
+ return FALSE;
+ }
+
+ SfxUndoAction* pAction = m_pData->pActUndoArray->aUndoActions[ m_pData->pActUndoArray->nCurUndoAction++ ].pAction;
+ const String sActionComment = pAction->GetComment();
try
{
- rAction.Redo();
+ // clear the guard/mutex before calling into the SfxUndoAction - this can be a extension-implemented UNO component
+ // nowadays ...
+ aGuard.clear();
+ if ( i_contextOrNull != NULL )
+ pAction->RedoWithContext( *i_contextOrNull );
+ else
+ pAction->Redo();
+ aGuard.reset();
}
- catch( Exception& e )
+ catch( ... )
{
- mbUndoEnabled = bUndoWasEnabled;
- throw e;
+ aGuard.reset();
+
+ // in theory, somebody might have tampered with all of *m_pData while the mutex was unlocked. So, see if
+ // we still find pAction in our current Undo array
+ size_t nCurAction = 0;
+ while ( nCurAction < m_pData->pActUndoArray->aUndoActions.size() )
+ {
+ if ( m_pData->pActUndoArray->aUndoActions[ nCurAction ].pAction == pAction )
+ {
+ // the Undo action is still there ...
+ // assume the error is a permanent failure, and clear the Undo stack
+ ImplClearRedo( aGuard, IUndoManager::CurrentLevel );
+ throw;
+ }
+ ++nCurAction;
+ }
+ OSL_ENSURE( false, "SfxUndoManager::Redo: can't clear the Undo stack after the failure - some other party was faster ..." );
+ throw;
}
- mbUndoEnabled = bUndoWasEnabled;
+ aGuard.scheduleNotification( &SfxUndoListener::actionRedone, sActionComment );
+
+ return TRUE;
}
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetRepeatActionCount() const
+size_t SfxUndoManager::GetRepeatActionCount() const
{
- return pActUndoArray->aUndoActions.Count();
+ UndoManagerGuard aGuard( *m_pData );
+ return m_pData->pActUndoArray->aUndoActions.size();
}
//------------------------------------------------------------------------
-XubString SfxUndoManager::GetRepeatActionComment( SfxRepeatTarget &rTarget, USHORT nNo ) const
+XubString SfxUndoManager::GetRepeatActionComment( SfxRepeatTarget &rTarget) const
{
- return pActUndoArray->aUndoActions[ pActUndoArray->aUndoActions.Count() - 1 - nNo ]
+ UndoManagerGuard aGuard( *m_pData );
+ return m_pData->pActUndoArray->aUndoActions[ m_pData->pActUndoArray->aUndoActions.size() - 1 ].pAction
->GetRepeatComment(rTarget);
}
//------------------------------------------------------------------------
-BOOL SfxUndoManager::Repeat( SfxRepeatTarget &rTarget, USHORT /*nFrom*/, USHORT /*nCount*/ )
+BOOL SfxUndoManager::Repeat( SfxRepeatTarget &rTarget )
{
- if ( pActUndoArray->aUndoActions.Count() )
+ UndoManagerGuard aGuard( *m_pData );
+ if ( !m_pData->pActUndoArray->aUndoActions.empty() )
{
- Repeat( rTarget, *pActUndoArray->aUndoActions[ pActUndoArray->aUndoActions.Count() - 1 ] );
+ SfxUndoAction* pAction = m_pData->pActUndoArray->aUndoActions[ m_pData->pActUndoArray->aUndoActions.size() - 1 ].pAction;
+ aGuard.clear();
+ if ( pAction->CanRepeat( rTarget ) )
+ pAction->Repeat( rTarget );
return TRUE;
}
@@ -517,30 +969,41 @@ BOOL SfxUndoManager::Repeat( SfxRepeatTarget &rTarget, USHORT /*nFrom*/, USHORT
//------------------------------------------------------------------------
-void SfxUndoManager::Repeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction )
+BOOL SfxUndoManager::CanRepeat( SfxRepeatTarget &rTarget ) const
{
- if ( rAction.CanRepeat(rTarget) )
- rAction.Repeat(rTarget);
+ UndoManagerGuard aGuard( *m_pData );
+ if ( !m_pData->pActUndoArray->aUndoActions.empty() )
+ {
+ size_t nActionNo = m_pData->pActUndoArray->aUndoActions.size() - 1;
+ return m_pData->pActUndoArray->aUndoActions[nActionNo].pAction->CanRepeat(rTarget);
+ }
+ return FALSE;
}
//------------------------------------------------------------------------
-BOOL SfxUndoManager::CanRepeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction ) const
+void SfxUndoManager::AddUndoListener( SfxUndoListener& i_listener )
{
- return rAction.CanRepeat(rTarget);
+ UndoManagerGuard aGuard( *m_pData );
+ m_pData->aListeners.push_back( &i_listener );
}
//------------------------------------------------------------------------
-BOOL SfxUndoManager::CanRepeat( SfxRepeatTarget &rTarget, USHORT nNo ) const
+void SfxUndoManager::RemoveUndoListener( SfxUndoListener& i_listener )
{
- if ( pActUndoArray->aUndoActions.Count() > nNo )
+ UndoManagerGuard aGuard( *m_pData );
+ for ( UndoListeners::iterator lookup = m_pData->aListeners.begin();
+ lookup != m_pData->aListeners.end();
+ ++lookup
+ )
{
- USHORT nActionNo = pActUndoArray->aUndoActions.Count() - 1 - nNo;
- return pActUndoArray->aUndoActions[nActionNo]->CanRepeat(rTarget);
+ if ( (*lookup) == &i_listener )
+ {
+ m_pData->aListeners.erase( lookup );
+ break;
+ }
}
-
- return FALSE;
}
//------------------------------------------------------------------------
@@ -554,69 +1017,270 @@ void SfxUndoManager::EnterListAction(
*/
{
- if( !mbUndoEnabled )
+ UndoManagerGuard aGuard( *m_pData );
+
+ if( !ImplIsUndoEnabled_Lock() )
return;
- if ( !pUndoArray->nMaxUndoActions )
+ if ( !m_pData->pUndoArray->nMaxUndoActions )
return;
- pFatherUndoArray=pActUndoArray;
- SfxListUndoAction *pAction=new SfxListUndoAction(
- rComment, rRepeatComment, nId, pActUndoArray);
- AddUndoAction( pAction );
- pActUndoArray=pAction;
+ m_pData->pFatherUndoArray = m_pData->pActUndoArray;
+ SfxListUndoAction* pAction = new SfxListUndoAction( rComment, rRepeatComment, nId, m_pData->pActUndoArray );
+ OSL_VERIFY( ImplAddUndoAction_NoNotify( pAction, false, false, aGuard ) );
+ // expected to succeed: all conditions under which it could fail should have been checked already
+ m_pData->pActUndoArray = pAction;
+
+ // notification
+ aGuard.scheduleNotification( &SfxUndoListener::listActionEntered, rComment );
}
//------------------------------------------------------------------------
-void SfxUndoManager::LeaveListAction()
+bool SfxUndoManager::IsInListAction() const
+{
+ UndoManagerGuard aGuard( *m_pData );
+ return ImplIsInListAction_Lock();
+}
-/* [Beschreibung]
+//------------------------------------------------------------------------
- Verlaesst die aktuelle ListAction und geht eine Ebene nach oben.
-*/
+bool SfxUndoManager::ImplIsInListAction_Lock() const
{
- if ( !mbUndoEnabled )
- return;
+ return ( m_pData->pActUndoArray != m_pData->pUndoArray );
+}
- if ( !pUndoArray->nMaxUndoActions )
- return;
+//------------------------------------------------------------------------
+
+size_t SfxUndoManager::GetListActionDepth() const
+{
+ UndoManagerGuard aGuard( *m_pData );
+ size_t nDepth(0);
- if( pActUndoArray == pUndoArray )
+ SfxUndoArray* pLookup( m_pData->pActUndoArray );
+ while ( pLookup != m_pData->pUndoArray )
{
- DBG_ERROR( "svl::SfxUndoManager::LeaveListAction(), called without calling EnterListAction()!" );
- return;
+ pLookup = pLookup->pFatherUndoArray;
+ ++nDepth;
}
- DBG_ASSERT(pActUndoArray->pFatherUndoArray,"svl::SfxUndoManager::LeaveListAction(), no father undo array!?");
+ return nDepth;
+}
+
+//------------------------------------------------------------------------
- SfxUndoArray* pTmp=pActUndoArray;
- pActUndoArray=pActUndoArray->pFatherUndoArray;
+size_t SfxUndoManager::LeaveListAction()
+{
+ UndoManagerGuard aGuard( *m_pData );
+ size_t nCount = ImplLeaveListAction( false, aGuard );
- // If no undo action where added, delete the undo list action
- SfxUndoAction *pTmpAction= pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1];
- if(!pTmp->nCurUndoAction)
+ if ( m_pData->mbClearUntilTopLevel )
{
- pActUndoArray->aUndoActions.Remove( --pActUndoArray->nCurUndoAction);
- delete pTmpAction;
+ ImplClearCurrentLevel_NoNotify( aGuard );
+ if ( !ImplIsInListAction_Lock() )
+ {
+ m_pData->mbClearUntilTopLevel = false;
+ aGuard.scheduleNotification( &SfxUndoListener::cleared );
+ }
+ nCount = 0;
}
- else
+
+ return nCount;
+}
+
+//------------------------------------------------------------------------
+
+size_t SfxUndoManager::LeaveAndMergeListAction()
+{
+ UndoManagerGuard aGuard( *m_pData );
+ return ImplLeaveListAction( true, aGuard );
+}
+
+//------------------------------------------------------------------------
+
+size_t SfxUndoManager::ImplLeaveListAction( const bool i_merge, UndoManagerGuard& i_guard )
+{
+ if ( !ImplIsUndoEnabled_Lock() )
+ return 0;
+
+ if ( !m_pData->pUndoArray->nMaxUndoActions )
+ return 0;
+
+ if( !ImplIsInListAction_Lock() )
+ {
+ DBG_ERROR( "svl::SfxUndoManager::ImplLeaveListAction, called without calling EnterListAction()!" );
+ return 0;
+ }
+
+ DBG_ASSERT( m_pData->pActUndoArray->pFatherUndoArray, "SfxUndoManager::ImplLeaveListAction, no father undo array!?" );
+
+ // the array/level which we're about to leave
+ SfxUndoArray* pArrayToLeave = m_pData->pActUndoArray;
+ // one step up
+ m_pData->pActUndoArray = m_pData->pActUndoArray->pFatherUndoArray;
+
+ // If no undo actions were added to the list, delete the list action
+ const size_t nListActionElements = pArrayToLeave->nCurUndoAction;
+ if ( nListActionElements == 0 )
+ {
+ SfxUndoAction* pCurrentAction= m_pData->pActUndoArray->aUndoActions[ m_pData->pActUndoArray->nCurUndoAction-1 ].pAction;
+ m_pData->pActUndoArray->aUndoActions.Remove( --m_pData->pActUndoArray->nCurUndoAction );
+ i_guard.markForDeletion( pCurrentAction );
+
+ i_guard.scheduleNotification( &SfxUndoListener::listActionCancelled );
+ return 0;
+ }
+
+ // now that it is finally clear the list action is non-trivial, and does participate in the Undo stack, clear
+ // the redo stack
+ ImplClearRedo( i_guard, IUndoManager::CurrentLevel );
+
+ SfxUndoAction* pCurrentAction= m_pData->pActUndoArray->aUndoActions[ m_pData->pActUndoArray->nCurUndoAction-1 ].pAction;
+ SfxListUndoAction* pListAction = dynamic_cast< SfxListUndoAction * >( pCurrentAction );
+ ENSURE_OR_RETURN( pListAction, "SfxUndoManager::ImplLeaveListAction: list action expected at this position!", nListActionElements );
+
+ if ( i_merge )
+ {
+ // merge the list action with its predecessor on the same level
+ OSL_ENSURE( m_pData->pActUndoArray->nCurUndoAction > 1,
+ "SfxUndoManager::ImplLeaveListAction: cannot merge the list action if there's no other action on the same level - check this beforehand!" );
+ if ( m_pData->pActUndoArray->nCurUndoAction > 1 )
+ {
+ SfxUndoAction* pPreviousAction = m_pData->pActUndoArray->aUndoActions[ m_pData->pActUndoArray->nCurUndoAction - 2 ].pAction;
+ m_pData->pActUndoArray->aUndoActions.Remove( m_pData->pActUndoArray->nCurUndoAction - 2 );
+ --m_pData->pActUndoArray->nCurUndoAction;
+ pListAction->aUndoActions.Insert( pPreviousAction, 0 );
+ ++pListAction->nCurUndoAction;
+
+ pListAction->SetComment( pPreviousAction->GetComment() );
+ }
+ }
+
+ // if the undo array has no comment, try to get it from its children
+ if ( pListAction->GetComment().Len() == 0 )
+ {
+ for( size_t n = 0; n < pListAction->aUndoActions.size(); n++ )
+ {
+ if( pListAction->aUndoActions[n].pAction->GetComment().Len() )
+ {
+ pListAction->SetComment( pListAction->aUndoActions[n].pAction->GetComment() );
+ break;
+ }
+ }
+ }
+
+ // notify listeners
+ i_guard.scheduleNotification( &SfxUndoListener::listActionLeft, pListAction->GetComment() );
+
+ // outta here
+ return nListActionElements;
+}
+
+//------------------------------------------------------------------------
+UndoStackMark SfxUndoManager::MarkTopUndoAction()
+{
+ UndoManagerGuard aGuard( *m_pData );
+
+ OSL_ENSURE( !IsInListAction(),
+ "SfxUndoManager::MarkTopUndoAction(): suspicious call!" );
+ OSL_ENSURE((m_pData->mnMarks + 1) < (m_pData->mnEmptyMark - 1),
+ "SfxUndoManager::MarkTopUndoAction(): mark overflow!");
+
+ size_t const nActionPos = m_pData->pUndoArray->nCurUndoAction;
+ if (0 == nActionPos)
+ {
+ --m_pData->mnEmptyMark;
+ return m_pData->mnEmptyMark;
+ }
+
+ m_pData->pUndoArray->aUndoActions[ nActionPos-1 ].aMarks.push_back(
+ ++m_pData->mnMarks );
+ return m_pData->mnMarks;
+}
+
+//------------------------------------------------------------------------
+void SfxUndoManager::RemoveMark( UndoStackMark const i_mark )
+{
+ UndoManagerGuard aGuard( *m_pData );
+
+ if ((m_pData->mnEmptyMark < i_mark) || (MARK_INVALID == i_mark))
{
- // if the undo array has no comment, try to get it from its children
- SfxListUndoAction* pList = dynamic_cast< SfxListUndoAction * >( pTmpAction );
- if( pList && pList->GetComment().Len() == 0 )
+ return; // nothing to remove
+ }
+ else if (i_mark == m_pData->mnEmptyMark)
+ {
+ --m_pData->mnEmptyMark; // never returned from MarkTop => invalid
+ return;
+ }
+
+ for ( size_t i=0; i<m_pData->pUndoArray->aUndoActions.size(); ++i )
+ {
+ MarkedUndoAction& rAction = m_pData->pUndoArray->aUndoActions[i];
+ for ( ::std::vector< UndoStackMark >::iterator markPos = rAction.aMarks.begin();
+ markPos != rAction.aMarks.end();
+ ++markPos
+ )
{
- USHORT n;
- for( n = 0; n < pList->aUndoActions.Count(); n++ )
+ if ( *markPos == i_mark )
{
- if( pList->aUndoActions[n]->GetComment().Len() )
- {
- pList->SetComment( pList->aUndoActions[n]->GetComment() );
- break;
- }
+ rAction.aMarks.erase( markPos );
+ return;
}
}
}
+ OSL_ENSURE( false, "SfxUndoManager::RemoveMark: mark not found!" );
+ // TODO: this might be too offensive. There are situations where we implicitly remove marks
+ // without our clients, in particular the client which created the mark, having a chance to know
+ // about this.
+}
+
+//------------------------------------------------------------------------
+bool SfxUndoManager::HasTopUndoActionMark( UndoStackMark const i_mark )
+{
+ UndoManagerGuard aGuard( *m_pData );
+
+ size_t nActionPos = m_pData->pUndoArray->nCurUndoAction;
+ if ( nActionPos == 0 )
+ {
+ return (i_mark == m_pData->mnEmptyMark);
+ }
+
+ const MarkedUndoAction& rAction =
+ m_pData->pUndoArray->aUndoActions[ nActionPos-1 ];
+ for ( ::std::vector< UndoStackMark >::const_iterator markPos = rAction.aMarks.begin();
+ markPos != rAction.aMarks.end();
+ ++markPos
+ )
+ {
+ if ( *markPos == i_mark )
+ return true;
+ }
+
+ return false;
+}
+
+//------------------------------------------------------------------------
+
+void SfxUndoManager::RemoveOldestUndoActions( size_t const i_count )
+{
+ UndoManagerGuard aGuard( *m_pData );
+
+ size_t nActionsToRemove = i_count;
+ while ( nActionsToRemove )
+ {
+ SfxUndoAction* pActionToRemove = m_pData->pUndoArray->aUndoActions[0].pAction;
+
+ if ( IsInListAction() && ( m_pData->pUndoArray->nCurUndoAction == 1 ) )
+ {
+ OSL_ENSURE( false, "SfxUndoManager::RemoveOldestUndoActions: cannot remove a not-yet-closed list action!" );
+ return;
+ }
+
+ aGuard.markForDeletion( pActionToRemove );
+ m_pData->pUndoArray->aUndoActions.Remove( 0 );
+ --m_pData->pUndoArray->nCurUndoAction;
+ --nActionsToRemove;
+ }
}
//------------------------------------------------------------------------
@@ -667,8 +1331,17 @@ SfxListUndoAction::SfxListUndoAction
void SfxListUndoAction::Undo()
{
- for(INT16 i=nCurUndoAction-1;i>=0;i--)
- aUndoActions[i]->Undo();
+ for(size_t i=nCurUndoAction;i>0;)
+ aUndoActions[--i].pAction->Undo();
+ nCurUndoAction=0;
+}
+
+//------------------------------------------------------------------------
+
+void SfxListUndoAction::UndoWithContext( SfxUndoContext& i_context )
+{
+ for(size_t i=nCurUndoAction;i>0;)
+ aUndoActions[--i].pAction->UndoWithContext( i_context );
nCurUndoAction=0;
}
@@ -676,25 +1349,34 @@ void SfxListUndoAction::Undo()
void SfxListUndoAction::Redo()
{
- for(USHORT i=nCurUndoAction;i<aUndoActions.Count();i++)
- aUndoActions[i]->Redo();
- nCurUndoAction = aUndoActions.Count();
+ for(size_t i=nCurUndoAction;i<aUndoActions.size();i++)
+ aUndoActions[i].pAction->Redo();
+ nCurUndoAction = aUndoActions.size();
+}
+
+//------------------------------------------------------------------------
+
+void SfxListUndoAction::RedoWithContext( SfxUndoContext& i_context )
+{
+ for(size_t i=nCurUndoAction;i<aUndoActions.size();i++)
+ aUndoActions[i].pAction->RedoWithContext( i_context );
+ nCurUndoAction = aUndoActions.size();
}
//------------------------------------------------------------------------
void SfxListUndoAction::Repeat(SfxRepeatTarget&rTarget)
{
- for(USHORT i=0;i<nCurUndoAction;i++)
- aUndoActions[i]->Repeat(rTarget);
+ for(size_t i=0;i<nCurUndoAction;i++)
+ aUndoActions[i].pAction->Repeat(rTarget);
}
//------------------------------------------------------------------------
BOOL SfxListUndoAction::CanRepeat(SfxRepeatTarget&r) const
{
- for(USHORT i=0;i<nCurUndoAction;i++)
- if(!aUndoActions[i]->CanRepeat(r))
+ for(size_t i=0;i<nCurUndoAction;i++)
+ if(!aUndoActions[i].pAction->CanRepeat(r))
return FALSE;
return TRUE;
}
@@ -703,12 +1385,12 @@ BOOL SfxListUndoAction::CanRepeat(SfxRepeatTarget&r) const
BOOL SfxListUndoAction::Merge( SfxUndoAction *pNextAction )
{
- return aUndoActions.Count() && aUndoActions[aUndoActions.Count()-1]->Merge( pNextAction );
+ return !aUndoActions.empty() && aUndoActions[aUndoActions.size()-1].pAction->Merge( pNextAction );
}
//------------------------------------------------------------------------
-SfxLinkUndoAction::SfxLinkUndoAction(SfxUndoManager *pManager)
+SfxLinkUndoAction::SfxLinkUndoAction(::svl::IUndoManager *pManager)
/* [Beschreibung]
Richtet eine LinkAction ein, die auf einen weiteren UndoManager zeigt.
@@ -718,10 +1400,15 @@ SfxLinkUndoAction::SfxLinkUndoAction(SfxUndoManager *pManager)
{
pUndoManager = pManager;
+ SfxUndoManager* pUndoManagerImplementation = dynamic_cast< SfxUndoManager* >( pManager );
+ ENSURE_OR_THROW( pUndoManagerImplementation != NULL, "unsupported undo manager implementation!" );
+ // yes, this cast is dirty. But reaching into the the SfxUndoManager's implementation,
+ // directly accessing its internal stack, and tampering with an action on that stack
+ // is dirty, too.
if ( pManager->GetMaxUndoActionCount() )
{
- USHORT nPos = pManager->GetUndoActionCount()-1;
- pAction = pManager->pActUndoArray->aUndoActions[nPos];
+ size_t nPos = pManager->GetUndoActionCount()-1;
+ pAction = pUndoManagerImplementation->m_pData->pActUndoArray->aUndoActions[nPos].pAction;
pAction->SetLinked();
}
else
@@ -733,7 +1420,7 @@ SfxLinkUndoAction::SfxLinkUndoAction(SfxUndoManager *pManager)
void SfxLinkUndoAction::Undo()
{
if ( pAction )
- pUndoManager->Undo(1);
+ pUndoManager->Undo();
}
//------------------------------------------------------------------------
@@ -741,7 +1428,7 @@ void SfxLinkUndoAction::Undo()
void SfxLinkUndoAction::Redo()
{
if ( pAction )
- pUndoManager->Redo(1);
+ pUndoManager->Redo();
}
//------------------------------------------------------------------------
@@ -749,7 +1436,7 @@ void SfxLinkUndoAction::Redo()
BOOL SfxLinkUndoAction::CanRepeat(SfxRepeatTarget& r) const
{
- return pAction && pUndoManager->CanRepeat(r,*pAction);
+ return pAction && pAction->CanRepeat(r);
}
@@ -758,8 +1445,8 @@ BOOL SfxLinkUndoAction::CanRepeat(SfxRepeatTarget& r) const
void SfxLinkUndoAction::Repeat(SfxRepeatTarget&r)
{
- if ( pAction )
- pUndoManager->Repeat(r,*pAction);
+ if ( pAction && pAction->CanRepeat( r ) )
+ pAction->Repeat( r );
}
@@ -797,11 +1484,10 @@ SfxLinkUndoAction::~SfxLinkUndoAction()
SfxUndoArray::~SfxUndoArray()
{
- while ( aUndoActions.Count() )
+ while ( !aUndoActions.empty() )
{
- SfxUndoAction *pAction =
- aUndoActions[ aUndoActions.Count() - 1 ];
- aUndoActions.Remove( aUndoActions.Count() - 1 );
+ SfxUndoAction *pAction = aUndoActions[ aUndoActions.size() - 1 ].pAction;
+ aUndoActions.Remove( aUndoActions.size() - 1 );
delete pAction;
}
}
@@ -811,6 +1497,3 @@ USHORT SfxLinkUndoAction::GetId() const
{
return pAction ? pAction->GetId() : 0;
}
-
-
-
diff --git a/svtools/inc/svtools/textdata.hxx b/svtools/inc/svtools/textdata.hxx
index 809d64248eb6..d0182e6a2c77 100644
--- a/svtools/inc/svtools/textdata.hxx
+++ b/svtools/inc/svtools/textdata.hxx
@@ -33,26 +33,6 @@
#include <svl/smplhint.hxx>
#include <tools/string.hxx>
-#define TEXTUNDO_START 100
-#define TEXTUNDO_REMOVECHARS 100
-#define TEXTUNDO_CONNECTPARAS 101
-#define TEXTUNDO_SPLITPARA 102
-#define TEXTUNDO_INSERTCHARS 103
-#define TEXTUNDO_DELCONTENT 104
-#define TEXTUNDO_DELETE 105
-#define TEXTUNDO_CUT 106
-#define TEXTUNDO_PASTE 107
-#define TEXTUNDO_INSERT 108
-#define TEXTUNDO_ATTRIBS 109
-#define TEXTUNDO_DRAGANDDROP 110
-#define TEXTUNDO_READ 111
-#define TEXTUNDO_END 149
-
-#define XTEXTUNDO_START 150
-#define XTEXTUNDO_END 199
-
-#define TEXTUNDO_USER 200
-
// Fuer Notify, wenn alle Absaetze geloescht wurden...
#define TEXT_PARA_ALL 0xFFFFFFFF
diff --git a/svtools/inc/svtools/texteng.hxx b/svtools/inc/svtools/texteng.hxx
index ef27edee2efe..ee49316c317f 100644
--- a/svtools/inc/svtools/texteng.hxx
+++ b/svtools/inc/svtools/texteng.hxx
@@ -39,7 +39,6 @@ class TextAttrib;
class TextCharAttrib;
class TextUndo;
class TextUndoManager;
-class SfxUndoManager;
class EditSelFunctionSet;
class EditSelEngine;
class IdleFormatter;
@@ -49,6 +48,11 @@ class SfxUndoAction;
class KeyEvent;
class Timer;
+namespace svl
+{
+ class IUndoManager;
+}
+
class TextLine;
class TETextPortion;
#include <svl/brdcst.hxx>
@@ -280,9 +284,10 @@ public:
BOOL IsRightToLeft() const { return mbRightToLeft; }
BOOL HasUndoManager() const { return mpUndoManager ? TRUE : FALSE; }
- SfxUndoManager& GetUndoManager();
- void UndoActionStart( USHORT nId );
- void UndoActionEnd( USHORT nId );
+ ::svl::IUndoManager&
+ GetUndoManager();
+ void UndoActionStart( USHORT nId = 0 );
+ void UndoActionEnd();
void InsertUndo( TextUndo* pUndo, BOOL bTryMerge = FALSE );
BOOL IsInUndo() { return mbIsInUndo; }
void SetIsInUndo( BOOL bInUndo ) { mbIsInUndo = bInUndo; }
diff --git a/svtools/inc/svtools/xtextedt.hxx b/svtools/inc/svtools/xtextedt.hxx
index 46c6441e005e..e95ba0b09359 100644
--- a/svtools/inc/svtools/xtextedt.hxx
+++ b/svtools/inc/svtools/xtextedt.hxx
@@ -31,10 +31,6 @@
#include <svtools/texteng.hxx>
#include <svtools/textview.hxx>
-#define XTEXTUNDO_REPLACEALL (XTEXTUNDO_START+1)
-#define XTEXTUNDO_INDENTBLOCK 122
-#define XTEXTUNDO_UNINDENTBLOCK 123
-
namespace com {
namespace sun {
namespace star {
diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx
index 9d6bc78caff9..5a59dcc3900f 100644
--- a/svtools/source/contnr/svtreebx.cxx
+++ b/svtools/source/contnr/svtreebx.cxx
@@ -1146,9 +1146,11 @@ void SvTreeListBox::ModelIsRemoving( SvListEntry* pEntry )
NotifyRemoving( (SvLBoxEntry*)pEntry );
}
-void SvTreeListBox::ModelHasRemoved( SvListEntry* /* pEntry */ )
+void SvTreeListBox::ModelHasRemoved( SvListEntry* pEntry )
{
DBG_CHKTHIS(SvTreeListBox,0);
+ if ( pEntry == pHdlEntry)
+ pHdlEntry = NULL;
pImp->EntryRemoved();
}
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 574f2bde4e1e..593065c0ac0c 100755
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -847,7 +847,8 @@ void SvtURLBox::ImplInit()
{
pImp = new SvtURLBox_Impl();
- SetHelpId( ".uno:OpenURL" );
+ if ( GetHelpId().getLength() == 0 )
+ SetHelpId( ".uno:OpenURL" );
EnableAutocomplete( FALSE );
SetText( String() );
diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx
index e0e136089d78..c0afe8962009 100644
--- a/svtools/source/edit/texteng.cxx
+++ b/svtools/source/edit/texteng.cxx
@@ -763,7 +763,7 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel,
BOOL bUndoAction = ( rCurSel.HasRange() || bDoOverwrite );
if ( bUndoAction )
- UndoActionStart( TEXTUNDO_INSERT );
+ UndoActionStart();
if ( rCurSel.HasRange() )
{
@@ -847,7 +847,7 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel,
TextModified();
if ( bUndoAction )
- UndoActionEnd( TEXTUNDO_INSERT );
+ UndoActionEnd();
}
return aPaM;
@@ -856,7 +856,7 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel,
TextPaM TextEngine::ImpInsertText( const TextSelection& rCurSel, const XubString& rStr )
{
- UndoActionStart( TEXTUNDO_INSERT );
+ UndoActionStart();
TextPaM aPaM;
@@ -908,7 +908,7 @@ TextPaM TextEngine::ImpInsertText( const TextSelection& rCurSel, const XubString
break;
}
- UndoActionEnd( TEXTUNDO_INSERT );
+ UndoActionEnd();
TextModified();
return aPaM;
@@ -1430,7 +1430,7 @@ void TextEngine::EnableUndo( BOOL bEnable )
mbUndoEnabled = bEnable;
}
-SfxUndoManager& TextEngine::GetUndoManager()
+::svl::IUndoManager& TextEngine::GetUndoManager()
{
if ( !mpUndoManager )
mpUndoManager = new TextUndoManager( this );
@@ -1447,7 +1447,7 @@ void TextEngine::UndoActionStart( USHORT nId )
}
}
-void TextEngine::UndoActionEnd( USHORT )
+void TextEngine::UndoActionEnd()
{
if ( IsUndoEnabled() && !IsInUndo() )
GetUndoManager().LeaveListAction();
@@ -2640,7 +2640,7 @@ BOOL TextEngine::Read( SvStream& rInput, const TextSelection* pSel )
BOOL bUpdate = GetUpdateMode();
SetUpdateMode( FALSE );
- UndoActionStart( TEXTUNDO_READ );
+ UndoActionStart();
TextSelection aSel;
if ( pSel )
aSel = *pSel;
@@ -2666,7 +2666,7 @@ BOOL TextEngine::Read( SvStream& rInput, const TextSelection* pSel )
aSel = ImpInsertParaBreak( aSel.GetEnd() );
}
- UndoActionEnd( TEXTUNDO_READ );
+ UndoActionEnd();
TextSelection aNewSel( aSel.GetEnd(), aSel.GetEnd() );
diff --git a/svtools/source/edit/textundo.cxx b/svtools/source/edit/textundo.cxx
index 4c243de16c31..2ad5e318e92f 100644
--- a/svtools/source/edit/textundo.cxx
+++ b/svtools/source/edit/textundo.cxx
@@ -54,7 +54,7 @@ TextUndoManager::~TextUndoManager()
{
}
-BOOL __EXPORT TextUndoManager::Undo( USHORT nCount )
+BOOL __EXPORT TextUndoManager::Undo()
{
if ( GetUndoActionCount() == 0 )
return FALSE;
@@ -62,7 +62,7 @@ BOOL __EXPORT TextUndoManager::Undo( USHORT nCount )
UndoRedoStart();
mpTextEngine->SetIsInUndo( TRUE );
- BOOL bDone = SfxUndoManager::Undo( nCount );
+ BOOL bDone = SfxUndoManager::Undo();
mpTextEngine->SetIsInUndo( FALSE );
UndoRedoEnd();
@@ -70,7 +70,7 @@ BOOL __EXPORT TextUndoManager::Undo( USHORT nCount )
return bDone;
}
-BOOL __EXPORT TextUndoManager::Redo( USHORT nCount )
+BOOL __EXPORT TextUndoManager::Redo()
{
if ( GetRedoActionCount() == 0 )
return FALSE;
@@ -79,7 +79,7 @@ BOOL __EXPORT TextUndoManager::Redo( USHORT nCount )
UndoRedoStart();
mpTextEngine->SetIsInUndo( TRUE );
- BOOL bDone = SfxUndoManager::Redo( nCount );
+ BOOL bDone = SfxUndoManager::Redo();
mpTextEngine->SetIsInUndo( FALSE );
UndoRedoEnd();
@@ -110,9 +110,8 @@ void TextUndoManager::UndoRedoEnd()
}
-TextUndo::TextUndo( USHORT nI, TextEngine* p )
+TextUndo::TextUndo( TextEngine* p )
{
- mnId = nI;
mpTextEngine = p;
}
@@ -120,12 +119,6 @@ TextUndo::~TextUndo()
{
}
-USHORT __EXPORT TextUndo::GetId() const
-{
- //nId sollte mal entfallen => GetId ueberall ueberladen...
- return mnId;
-}
-
XubString __EXPORT TextUndo::GetComment() const
{
// return mpTextEngine->GetUndoComment( this );
@@ -140,7 +133,7 @@ void TextUndo::SetSelection( const TextSelection& rSel )
TextUndoDelPara::TextUndoDelPara( TextEngine* pTextEngine, TextNode* pNode, ULONG nPara )
- : TextUndo( TEXTUNDO_DELCONTENT, pTextEngine )
+ : TextUndo( pTextEngine )
{
mpNode = pNode;
mnPara = nPara;
@@ -191,7 +184,7 @@ void __EXPORT TextUndoDelPara::Redo()
// TextUndoConnectParas
// ------------------------------------------------------------------------
TextUndoConnectParas::TextUndoConnectParas( TextEngine* pTextEngine, ULONG nPara, USHORT nPos )
- : TextUndo( TEXTUNDO_CONNECTPARAS, pTextEngine )
+ : TextUndo( pTextEngine )
{
mnPara = nPara;
mnSepPos = nPos;
@@ -215,7 +208,7 @@ void __EXPORT TextUndoConnectParas::Redo()
TextUndoSplitPara::TextUndoSplitPara( TextEngine* pTextEngine, ULONG nPara, USHORT nPos )
- : TextUndo( TEXTUNDO_SPLITPARA, pTextEngine )
+ : TextUndo( pTextEngine )
{
mnPara = nPara;
mnSepPos = nPos;
@@ -239,7 +232,7 @@ void __EXPORT TextUndoSplitPara::Redo()
TextUndoInsertChars::TextUndoInsertChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const XubString& rStr )
- : TextUndo( TEXTUNDO_INSERTCHARS, pTextEngine ),
+ : TextUndo( pTextEngine ),
maTextPaM( rTextPaM ), maText( rStr )
{
}
@@ -281,7 +274,7 @@ BOOL __EXPORT TextUndoInsertChars::Merge( SfxUndoAction* pNextAction )
TextUndoRemoveChars::TextUndoRemoveChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const XubString& rStr )
- : TextUndo( TEXTUNDO_REMOVECHARS, pTextEngine ),
+ : TextUndo( pTextEngine ),
maTextPaM( rTextPaM ), maText( rStr )
{
}
@@ -304,7 +297,7 @@ void __EXPORT TextUndoRemoveChars::Redo()
TextUndoSetAttribs::TextUndoSetAttribs( TextEngine* pTextEngine, const TextSelection& rSel )
- : TextUndo( TEXTUNDO_ATTRIBS, pTextEngine ), maSelection( rSel )
+ : TextUndo( pTextEngine ), maSelection( rSel )
{
maSelection.Justify();
// aNewAttribs.Set( rNewItems );
diff --git a/svtools/source/edit/textundo.hxx b/svtools/source/edit/textundo.hxx
index cc26c0b51ef6..69b5fc393744 100644
--- a/svtools/source/edit/textundo.hxx
+++ b/svtools/source/edit/textundo.hxx
@@ -47,16 +47,15 @@ public:
~TextUndoManager();
using SfxUndoManager::Undo;
- virtual BOOL Undo( USHORT nCount=1 );
+ virtual BOOL Undo();
using SfxUndoManager::Redo;
- virtual BOOL Redo( USHORT nCount=1 );
+ virtual BOOL Redo();
};
class TextUndo : public SfxUndoAction
{
private:
- USHORT mnId;
TextEngine* mpTextEngine;
protected:
@@ -69,7 +68,7 @@ protected:
public:
TYPEINFO();
- TextUndo( USHORT nId, TextEngine* pTextEngine );
+ TextUndo( TextEngine* pTextEngine );
virtual ~TextUndo();
TextEngine* GetTextEngine() const { return mpTextEngine; }
@@ -78,7 +77,6 @@ public:
virtual void Redo() = 0;
virtual XubString GetComment() const;
- virtual USHORT GetId() const;
};
#endif // _TEXTUNDO_HXX
diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx
index 48cd23bdcc6f..64c6470be1e8 100644
--- a/svtools/source/edit/textview.cxx
+++ b/svtools/source/edit/textview.cxx
@@ -311,9 +311,9 @@ void TextView::DeleteSelected()
{
// HideSelection();
- mpImpl->mpTextEngine->UndoActionStart( TEXTUNDO_DELETE );
+ mpImpl->mpTextEngine->UndoActionStart();
TextPaM aPaM = mpImpl->mpTextEngine->ImpDeleteText( mpImpl->maSelection );
- mpImpl->mpTextEngine->UndoActionEnd( TEXTUNDO_DELETE );
+ mpImpl->mpTextEngine->UndoActionEnd();
ImpSetSelection( aPaM );
mpImpl->mpTextEngine->FormatAndUpdate( this );
@@ -695,7 +695,7 @@ BOOL TextView::KeyInput( const KeyEvent& rKeyEvent )
default: break;
}
- mpImpl->mpTextEngine->UndoActionStart( TEXTUNDO_DELETE );
+ mpImpl->mpTextEngine->UndoActionStart();
if(mpImpl->mbSupportProtectAttribute)
{
//expand selection to include all protected content - if there is any
@@ -717,7 +717,7 @@ BOOL TextView::KeyInput( const KeyEvent& rKeyEvent )
}
}
aCurSel = ImpDelete( nDel, nMode );
- mpImpl->mpTextEngine->UndoActionEnd( TEXTUNDO_DELETE );
+ mpImpl->mpTextEngine->UndoActionEnd();
bModified = TRUE;
bAllowIdle = FALSE;
}
@@ -745,7 +745,7 @@ BOOL TextView::KeyInput( const KeyEvent& rKeyEvent )
if ( !mpImpl->mbReadOnly && !rKeyEvent.GetKeyCode().IsMod1() &&
!rKeyEvent.GetKeyCode().IsMod2() && ImplCheckTextLen( 'x' ) )
{
- mpImpl->mpTextEngine->UndoActionStart( TEXTUNDO_INSERT );
+ mpImpl->mpTextEngine->UndoActionStart();
aCurSel = mpImpl->mpTextEngine->ImpInsertParaBreak( aCurSel );
if ( mpImpl->mbAutoIndent )
{
@@ -760,7 +760,7 @@ BOOL TextView::KeyInput( const KeyEvent& rKeyEvent )
if ( n )
aCurSel = mpImpl->mpTextEngine->ImpInsertText( aCurSel, pPrev->GetText().Copy( 0, n ) );
}
- mpImpl->mpTextEngine->UndoActionEnd( TEXTUNDO_INSERT );
+ mpImpl->mpTextEngine->UndoActionEnd();
bModified = TRUE;
}
else
@@ -1122,21 +1122,21 @@ void TextView::Scroll( long ndX, long ndY )
void TextView::Undo()
{
mpImpl->mpTextEngine->SetActiveView( this );
- mpImpl->mpTextEngine->GetUndoManager().Undo( 1 );
+ mpImpl->mpTextEngine->GetUndoManager().Undo();
}
void TextView::Redo()
{
mpImpl->mpTextEngine->SetActiveView( this );
- mpImpl->mpTextEngine->GetUndoManager().Redo( 0 );
+ mpImpl->mpTextEngine->GetUndoManager().Redo();
}
void TextView::Cut()
{
- mpImpl->mpTextEngine->UndoActionStart( TEXTUNDO_CUT );
+ mpImpl->mpTextEngine->UndoActionStart();
Copy();
DeleteSelected();
- mpImpl->mpTextEngine->UndoActionEnd( TEXTUNDO_CUT );
+ mpImpl->mpTextEngine->UndoActionEnd();
}
void TextView::Copy( uno::Reference< datatransfer::clipboard::XClipboard >& rxClipboard )
@@ -1370,7 +1370,7 @@ void TextView::InsertText( const XubString& rStr, BOOL bSelect )
void TextView::InsertNewText( const rtl::OUString& rStr, BOOL bSelect )
{
// HideSelection();
- mpImpl->mpTextEngine->UndoActionStart( TEXTUNDO_INSERT );
+ mpImpl->mpTextEngine->UndoActionStart();
/* #i87633#
break inserted text into chunks that fit into the underlying String
@@ -1405,7 +1405,7 @@ void TextView::InsertNewText( const rtl::OUString& rStr, BOOL bSelect )
nLen -= nChunkLen;
nPos += nChunkLen;
}
- mpImpl->mpTextEngine->UndoActionEnd( TEXTUNDO_INSERT );
+ mpImpl->mpTextEngine->UndoActionEnd();
mpImpl->mpTextEngine->FormatAndUpdate( this );
}
@@ -1417,9 +1417,9 @@ void TextView::InsertText( const XubString& rStr, BOOL bSelect )
TextSelection aNewSel( mpImpl->maSelection );
- mpImpl->mpTextEngine->UndoActionStart( TEXTUNDO_INSERT );
+ mpImpl->mpTextEngine->UndoActionStart();
TextPaM aPaM = mpImpl->mpTextEngine->ImpInsertText( mpImpl->maSelection, rStr );
- mpImpl->mpTextEngine->UndoActionEnd( TEXTUNDO_INSERT );
+ mpImpl->mpTextEngine->UndoActionEnd();
if ( bSelect )
{
@@ -2169,7 +2169,7 @@ void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEv
HideSelection();
ImpSetSelection( mpImpl->mpDDInfo->maDropPos );
- mpImpl->mpTextEngine->UndoActionStart( TEXTUNDO_DRAGANDDROP );
+ mpImpl->mpTextEngine->UndoActionStart();
String aText;
uno::Reference< datatransfer::XTransferable > xDataObj = rDTDE.Transferable;
@@ -2247,7 +2247,7 @@ void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEv
mpImpl->mpTextEngine->ImpDeleteText( aPrevSel );
}
- mpImpl->mpTextEngine->UndoActionEnd( TEXTUNDO_DRAGANDDROP );
+ mpImpl->mpTextEngine->UndoActionEnd();
delete mpImpl->mpDDInfo;
mpImpl->mpDDInfo = 0;
diff --git a/svtools/source/edit/xtextedt.cxx b/svtools/source/edit/xtextedt.cxx
index 0a4907edcadd..10e05a58676a 100644
--- a/svtools/source/edit/xtextedt.cxx
+++ b/svtools/source/edit/xtextedt.cxx
@@ -327,7 +327,7 @@ USHORT ExtTextView::Replace( const util::SearchOptions& rSearchOptions, BOOL bAl
BOOL bFound = pTextEngine->Search( aSel, rSearchOptions, TRUE );
if ( bFound )
- pTextEngine->UndoActionStart( XTEXTUNDO_REPLACEALL );
+ pTextEngine->UndoActionStart();
while ( bFound )
{
nFound++;
@@ -341,7 +341,7 @@ USHORT ExtTextView::Replace( const util::SearchOptions& rSearchOptions, BOOL bAl
{
SetSelection( aSel.GetStart() );
pTextEngine->FormatAndUpdate( this );
- pTextEngine->UndoActionEnd( XTEXTUNDO_REPLACEALL );
+ pTextEngine->UndoActionEnd();
}
}
return nFound;
@@ -355,7 +355,7 @@ BOOL ExtTextView::ImpIndentBlock( BOOL bRight )
aSel.Justify();
HideSelection();
- GetTextEngine()->UndoActionStart( bRight ? XTEXTUNDO_INDENTBLOCK : XTEXTUNDO_UNINDENTBLOCK );
+ GetTextEngine()->UndoActionStart();
ULONG nStartPara = aSel.GetStart().GetPara();
ULONG nEndPara = aSel.GetEnd().GetPara();
@@ -386,7 +386,7 @@ BOOL ExtTextView::ImpIndentBlock( BOOL bRight )
}
}
- GetTextEngine()->UndoActionEnd( bRight ? XTEXTUNDO_INDENTBLOCK : XTEXTUNDO_UNINDENTBLOCK );
+ GetTextEngine()->UndoActionEnd();
BOOL bRange = aSel.HasRange();
if ( bRight )
diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx
index a6c3617b50a7..3c118445c6f4 100644
--- a/svtools/source/misc/templatefoldercache.cxx
+++ b/svtools/source/misc/templatefoldercache.cxx
@@ -116,8 +116,8 @@ namespace svt
//=====================================================================
struct TemplateContent;
typedef ::std::vector< ::vos::ORef< TemplateContent > > TemplateFolderContent;
- typedef TemplateFolderContent::const_iterator ConstFolderIterator;
- typedef TemplateFolderContent::iterator FolderIterator;
+ typedef TemplateFolderContent::const_iterator ConstFolderIterator;
+ typedef TemplateFolderContent::iterator FolderIterator;
/** a struct describing one content in one of the template dirs (or at least it's relevant aspects)
*/
@@ -706,15 +706,18 @@ namespace svt
m_aCurrentState.swap( aTemplateFolderContent );
// the template directories from the config
- String aDirs = SvtPathOptions().GetTemplatePath();
+ const SvtPathOptions aPathOptions;
+ String aDirs = aPathOptions.GetTemplatePath();
sal_uInt16 nDirs = aDirs.GetTokenCount( ';' );
m_aCurrentState.reserve( nDirs );
// loop through all the root-level template folders
for ( sal_uInt16 i=0; i<nDirs; ++i)
{
+ String sTemplatePath( aDirs.GetToken( i, ';' ) );
+ sTemplatePath = aPathOptions.ExpandMacros( sTemplatePath );
// create a new entry
- m_aCurrentState.push_back( new TemplateContent( INetURLObject( aDirs.GetToken( i, ';' ) ) ) );
+ m_aCurrentState.push_back( new TemplateContent( INetURLObject( sTemplatePath ) ) );
TemplateFolderContent::iterator aCurrentRoot = m_aCurrentState.end();
--aCurrentRoot;
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index 9ff37fbc2af4..bc5627d2fab6 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -1650,7 +1650,7 @@ void SVTXRoadmap::ImplSetNewImage()
{
OSL_PRECOND( GetWindow(), "SVTXRoadmap::ImplSetNewImage: window is required to be not-NULL!" );
::svt::ORoadmap* pButton = static_cast< ::svt::ORoadmap* >( GetWindow() );
- pButton->SetRoadmapBitmap( GetBitmap() );
+ pButton->SetRoadmapBitmap( GetImage().GetBitmapEx() );
}
void SVTXRoadmap::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk
index 453a0aa473f8..fa6d3f4d591f 100644
--- a/toolkit/Library_tk.mk
+++ b/toolkit/Library_tk.mk
@@ -81,6 +81,8 @@ $(eval $(call gb_Library_add_exception_objects,tk,\
toolkit/source/awt/vclxsystemdependentwindow \
toolkit/source/awt/vclxtabcontrol \
toolkit/source/awt/vclxtabpage \
+ toolkit/source/awt/vclxtabpagecontainer \
+ toolkit/source/awt/animatedimagespeer \
toolkit/source/awt/vclxtoolkit \
toolkit/source/awt/vclxtopwindow \
toolkit/source/awt/vclxwindow \
@@ -89,6 +91,7 @@ $(eval $(call gb_Library_add_exception_objects,tk,\
toolkit/source/awt/xsimpleanimation \
toolkit/source/awt/xthrobber \
toolkit/source/controls/accessiblecontrolcontext \
+ toolkit/source/controls/controlmodelcontainerbase \
toolkit/source/controls/dialogcontrol \
toolkit/source/controls/eventcontainer \
toolkit/source/controls/formattedcontrol \
@@ -99,12 +102,16 @@ $(eval $(call gb_Library_add_exception_objects,tk,\
toolkit/source/controls/grid/gridcontrol \
toolkit/source/controls/roadmapcontrol \
toolkit/source/controls/roadmapentry \
+ toolkit/source/controls/tabpagecontainer \
+ toolkit/source/controls/tabpagemodel \
toolkit/source/controls/stdtabcontroller \
toolkit/source/controls/stdtabcontrollermodel \
toolkit/source/controls/tkscrollbar \
toolkit/source/controls/tksimpleanimation \
toolkit/source/controls/tkspinbutton \
toolkit/source/controls/tkthrobber \
+ toolkit/source/controls/animatedimages \
+ toolkit/source/controls/spinningprogress \
toolkit/source/controls/tree/treecontrol \
toolkit/source/controls/tree/treedatamodel \
toolkit/source/controls/unocontrol \
@@ -122,7 +129,6 @@ $(eval $(call gb_Library_add_exception_objects,tk,\
toolkit/source/helper/property \
toolkit/source/helper/registerservices \
toolkit/source/helper/servicenames \
- toolkit/source/helper/throbberimpl \
toolkit/source/helper/tkresmgr \
toolkit/source/helper/unomemorystream \
toolkit/source/helper/unopropertyarrayhelper \
diff --git a/toolkit/Package_inc.mk b/toolkit/Package_inc.mk
index b954bf4e1161..88832533490c 100644
--- a/toolkit/Package_inc.mk
+++ b/toolkit/Package_inc.mk
@@ -59,7 +59,6 @@ $(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/mutexhelper.hxx
$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/property.hxx,toolkit/helper/property.hxx))
$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/servicenames.hxx,toolkit/helper/servicenames.hxx))
$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/solarrelease.hxx,toolkit/helper/solarrelease.hxx))
-$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/throbberimpl.hxx,toolkit/helper/throbberimpl.hxx))
$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/tkresmgr.hxx,toolkit/helper/tkresmgr.hxx))
$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/unomemorystream.hxx,toolkit/helper/unomemorystream.hxx))
$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/unopropertyarrayhelper.hxx,toolkit/helper/unopropertyarrayhelper.hxx))
diff --git a/toolkit/inc/toolkit/awt/animatedimagespeer.hxx b/toolkit/inc/toolkit/awt/animatedimagespeer.hxx
new file mode 100755
index 000000000000..b9bdecdf0e47
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/animatedimagespeer.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ * 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 TOOLKIT_ANIMATEDIMAGEPEER_HXX
+#define TOOLKIT_ANIMATEDIMAGEPEER_HXX
+
+#include "toolkit/awt/vclxwindow.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XAnimation.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase3.hxx>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/noncopyable.hpp>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= AnimatedImagesPeer
+ //==================================================================================================================
+ struct AnimatedImagesPeer_Data;
+ typedef ::cppu::ImplInheritanceHelper3 < VCLXWindow
+ , ::com::sun::star::awt::XAnimation
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::util::XModifyListener
+ > AnimatedImagesPeer_Base;
+
+ class AnimatedImagesPeer :public AnimatedImagesPeer_Base
+ ,public ::boost::noncopyable
+ {
+ public:
+ AnimatedImagesPeer();
+
+ protected:
+ ~AnimatedImagesPeer();
+
+ public:
+ // XAnimation
+ virtual void SAL_CALL startAnimation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL stopAnimation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isAnimationRunning( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // VclWindowPeer
+ virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) 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);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& i_event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ protected:
+ void ProcessWindowEvent( const VclWindowEvent& i_windowEvent );
+
+ private:
+ /** updates our images with the ones from the givem XAnimatedImages component
+ */
+ void impl_updateImages_nolck( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_animatedImages );
+
+ private:
+ ::boost::scoped_ptr< AnimatedImagesPeer_Data > m_pData;
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // TOOLKIT_ANIMATEDIMAGEPEER_HXX
diff --git a/toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx b/toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx
new file mode 100644
index 000000000000..d4fe2a727b43
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx
@@ -0,0 +1,90 @@
+// ----------------------------------------------------
+// class VCLXDialog
+/*************************************************************************
+ *
+ * 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 _TOOLKIT_AWT_VCLXTABPAGECONTAINER_HXX_
+#define _TOOLKIT_AWT_VCLXTABPAGECONTAINER_HXX_
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include "toolkit/awt/vclxwindow.hxx"
+//#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainer.hpp>
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <toolkit/awt/vclxcontainer.hxx>
+
+// ----------------------------------------------------
+typedef ::cppu::ImplInheritanceHelper2 < VCLXContainer
+ , ::com::sun::star::awt::tab::XTabPageContainer
+ , ::com::sun::star::container::XContainerListener
+ > VCLXTabPageContainer_Base;
+class VCLXTabPageContainer : public VCLXTabPageContainer_Base
+{
+public:
+ VCLXTabPageContainer();
+ ~VCLXTabPageContainer();
+
+ // ::com::sun::star::awt::XView
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDevice,
+ ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::grid::XTabPageContainer
+ virtual ::sal_Int16 SAL_CALL getActiveTabPageID() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getTabPageCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isTabPageActive( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPage( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPageByID( ::sal_Int16 tabPageID ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+ 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);
+
+ // ::com::sun::star::awt::XVclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+protected:
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+private:
+ sal_Int16 m_nActiveTabPageId;
+ TabPageListenerMultiplexer m_aTabPageListeners;
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > > m_aTabPages;
+};
+#endif // _TOOLKIT_AWT_VCLXTABPAGEMODEL_HXX_
diff --git a/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx b/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx
new file mode 100644
index 000000000000..670ed25c0f2d
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx
@@ -0,0 +1,82 @@
+// ----------------------------------------------------
+// class VCLXDialog
+/*************************************************************************
+ *
+ * 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 _TOOLKIT_AWT_VCLXTABPAGEMODEL_HXX_
+#define _TOOLKIT_AWT_VCLXTABPAGEMODEL_HXX_
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include "toolkit/awt/vclxwindow.hxx"
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/awt/tab/XTabPage.hpp>
+#include "forward.hxx"
+#include <cppuhelper/implbase1.hxx>
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel,
+ ::com::sun::star::awt::tab::XTabPageModel
+ > VCLXTabPageModel_Base;
+class VCLXTabPageModel : public VCLXTabPageModel_Base
+{
+public:
+ VCLXTabPageModel();
+ VCLXTabPageModel( const VCLXTabPageModel& rModel ) : VCLXTabPageModel_Base( rModel ) {;}
+ ~VCLXTabPageModel();
+
+ // ::com::sun::star::awt::XView
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDevice,
+ ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
+
+ // virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+ UnoControlModel* Clone() const { return new VCLXTabPageModel( *this ); }
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::awt::XVclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::tab::XTabPageModel
+ virtual ::sal_Int16 SAL_CALL getTabPageID() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getEnabled() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTooltip() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException);
+protected:
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+};
+#endif // _TOOLKIT_AWT_VCLXTABPAGEMODEL_HXX_
diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx
index 36ac2fa51337..1d3b10120e0c 100644
--- a/toolkit/inc/toolkit/awt/vclxwindows.hxx
+++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -121,7 +121,7 @@ private:
Image maImage;
protected:
- BitmapEx GetBitmap() const { return maImage.GetBitmapEx(); }
+ const Image& GetImage() const { return maImage; }
protected:
// ::com::sun::star::awt::XWindow
diff --git a/toolkit/inc/toolkit/awt/xsimpleanimation.hxx b/toolkit/inc/toolkit/awt/xsimpleanimation.hxx
index dc8fbe4506ed..9e6043b7d9ef 100644
--- a/toolkit/inc/toolkit/awt/xsimpleanimation.hxx
+++ b/toolkit/inc/toolkit/awt/xsimpleanimation.hxx
@@ -33,40 +33,28 @@
#include <comphelper/uno3.hxx>
#include <com/sun/star/awt/XSimpleAnimation.hpp>
+#include <boost/scoped_ptr.hpp>
+
//........................................................................
namespace toolkit
{
- class Throbber_Impl;
//........................................................................
//====================================================================
//= XSimpleAnimation
//====================================================================
- typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSimpleAnimation
- > XSimpleAnimation_Base;
+ typedef ::cppu::ImplInheritanceHelper1 < VCLXWindow
+ , ::com::sun::star::awt::XSimpleAnimation
+ > XSimpleAnimation_Base;
- class XSimpleAnimation :public VCLXWindow
- ,public XSimpleAnimation_Base
+ class XSimpleAnimation : public XSimpleAnimation_Base
{
- private:
- //::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > maImageList;
- sal_Bool mbRepeat;
- sal_Int32 mnStepTime;
-
- Throbber_Impl *mpThrobber;
-
public:
XSimpleAnimation();
protected:
~XSimpleAnimation();
- // XInterface
- DECLARE_XINTERFACE()
-
- // XTypeProvider
- DECLARE_XTYPEPROVIDER()
-
// XSimpleAnimation
virtual void SAL_CALL start() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL stop() throw (::com::sun::star::uno::RuntimeException);
@@ -76,9 +64,6 @@ namespace toolkit
virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
- // VCLXWindow
- void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
-
private:
XSimpleAnimation( const XSimpleAnimation& ); // never implemented
XSimpleAnimation& operator=( const XSimpleAnimation& ); // never implemented
diff --git a/toolkit/inc/toolkit/awt/xthrobber.hxx b/toolkit/inc/toolkit/awt/xthrobber.hxx
index 511f3f76ecf6..67015e049a48 100644
--- a/toolkit/inc/toolkit/awt/xthrobber.hxx
+++ b/toolkit/inc/toolkit/awt/xthrobber.hxx
@@ -33,23 +33,25 @@
#include <comphelper/uno3.hxx>
#include <com/sun/star/awt/XThrobber.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/noncopyable.hpp>
+
//........................................................................
namespace toolkit
{
//........................................................................
- class Throbber_Impl;
//====================================================================
//= XThrobber
//====================================================================
- typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XThrobber
- > XThrobber_Base;
+ typedef ::cppu::ImplInheritanceHelper1 < VCLXWindow
+ , ::com::sun::star::awt::XThrobber
+ > XThrobber_Base;
- class XThrobber :public VCLXWindow
- ,public XThrobber_Base
+ class XThrobber :public XThrobber_Base
+ ,public ::boost::noncopyable
{
private:
- Throbber_Impl *mpThrobber;
void SAL_CALL InitImageList() throw(::com::sun::star::uno::RuntimeException);
public:
@@ -58,22 +60,12 @@ namespace toolkit
protected:
~XThrobber();
- // XInterface
- DECLARE_XINTERFACE()
-
- // XTypeProvider
- DECLARE_XTYPEPROVIDER()
-
// XThrobber
virtual void SAL_CALL start() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL stop() throw (::com::sun::star::uno::RuntimeException);
- // VclWindowPeer
- virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
-
// VCLXWindow
- void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
+ virtual void SetWindow( Window* pWindow );
private:
XThrobber( const XThrobber& ); // never implemented
diff --git a/toolkit/inc/toolkit/controls/animatedimages.hxx b/toolkit/inc/toolkit/controls/animatedimages.hxx
new file mode 100755
index 000000000000..96791c252b0b
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/animatedimages.hxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ * 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 TOOLKIT_ANIMATEDIMAGES_HXX
+#define TOOLKIT_ANIMATEDIMAGES_HXX
+
+#include "toolkit/controls/unocontrolbase.hxx"
+#include "toolkit/controls/unocontrolmodel.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XAnimation.hpp>
+#include <com/sun/star/awt/XAnimatedImages.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //=
+ //==================================================================================================================
+ typedef ::cppu::AggImplInheritanceHelper2 < UnoControlBase
+ , ::com::sun::star::awt::XAnimation
+ , ::com::sun::star::container::XContainerListener
+ > AnimatedImagesControl_Base;
+
+ class AnimatedImagesControl : public AnimatedImagesControl_Base
+ {
+ public:
+ AnimatedImagesControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ // XAnimation
+ virtual void SAL_CALL startAnimation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL stopAnimation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isAnimationRunning( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XControl
+ sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& i_rModel ) throw ( ::com::sun::star::uno::RuntimeException );
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& i_toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& i_parentPeer ) 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);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_event ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+ //==================================================================================================================
+ //= AnimatedImagesControlModel
+ //==================================================================================================================
+ struct AnimatedImagesControlModel_Data;
+ typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel
+ , ::com::sun::star::awt::XAnimatedImages
+ > AnimatedImagesControlModel_Base;
+ class AnimatedImagesControlModel : public AnimatedImagesControlModel_Base
+ {
+ public:
+ AnimatedImagesControlModel();
+ AnimatedImagesControlModel( const AnimatedImagesControlModel& i_copySource );
+
+ virtual UnoControlModel* Clone() const;
+
+ // XPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XAnimatedImages
+ virtual ::sal_Int32 SAL_CALL getStepTime() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setStepTime( ::sal_Int32 _steptime ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getAutoRepeat() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAutoRepeat( ::sal_Bool _autorepeat ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getScaleMode() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setScaleMode( ::sal_Int16 _scalemode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getImageSetCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getImageSet( ::sal_Int32 i_index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertImageSet( ::sal_Int32 i_index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& i_imageURLs ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL replaceImageSet( ::sal_Int32 i_index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& i_imageURLs ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeImageSet( ::sal_Int32 i_index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAnimatedImages::XContainer
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ ~AnimatedImagesControlModel();
+
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+
+ private:
+ ::boost::scoped_ptr< AnimatedImagesControlModel_Data >
+ m_pData;
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // TOOLKIT_ANIMATEDIMAGES_HXX
diff --git a/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx
new file mode 100644
index 000000000000..d50fecd8a344
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * 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 TOOLKIT_CONTROL_MODEL_CONTAINERBASE_HXX
+#define TOOLKIT_CONTROL_MODEL_CONTAINERBASE_HXX
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <com/sun/star/util/XChangesNotifier.hpp>
+#include <com/sun/star/util/XChangesListener.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <cppuhelper/implbase8.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+// ----------------------------------------------------
+// class ControlModelContainerBase
+// ----------------------------------------------------
+typedef UnoControlModel ControlModel_Base;
+typedef ::cppu::AggImplInheritanceHelper8 < ControlModel_Base
+ , ::com::sun::star::lang::XMultiServiceFactory
+ , ::com::sun::star::container::XContainer
+ , ::com::sun::star::container::XNameContainer
+ , ::com::sun::star::awt::XTabControllerModel
+ , ::com::sun::star::util::XChangesNotifier
+ , ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::awt::tab::XTabPageModel
+ , ::com::sun::star::lang::XInitialization
+ > ControlModelContainer_IBase;
+
+class ControlModelContainerBase : public ControlModelContainer_IBase
+{
+public:
+ // would like to make this typedef private, too, but the Forte 7 compiler does have
+ // problems with this .....
+ typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >, ::rtl::OUString >
+ UnoControlModelHolder;
+private:
+ typedef ::std::list< UnoControlModelHolder > UnoControlModelHolderList;
+
+ // for grouping control models (XTabControllerModel::getGroupXXX)
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >
+ ModelGroup;
+ typedef ::std::vector< ModelGroup > AllGroups;
+
+ friend struct CloneControlModel;
+ friend struct FindControlModel;
+ friend struct CompareControlModel;
+
+protected:
+ ContainerListenerMultiplexer maContainerListeners;
+ ::cppu::OInterfaceContainerHelper maChangeListeners;
+ UnoControlModelHolderList maModels;
+
+ AllGroups maGroups;
+ sal_Bool mbGroupsUpToDate;
+
+ bool m_bEnabled;
+ ::rtl::OUString m_sTitle;
+ ::rtl::OUString m_sImageURL;
+ ::rtl::OUString m_sTooltip;
+ sal_Int16 m_nTabPageId;
+
+
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ UnoControlModelHolderList::iterator ImplFindElement( const ::rtl::OUString& rName );
+
+public:
+ ControlModelContainerBase();
+ ControlModelContainerBase( const ControlModelContainerBase& rModel );
+ ~ControlModelContainerBase();
+
+ UnoControlModel* Clone() const;
+
+ // ::com::sun::star::container::XContainer
+ void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XElementAcces
+ ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
+ void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XMultiServiceFactory
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTabControllerModel
+ virtual sal_Bool SAL_CALL getGroupControl( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setGroupControl( sal_Bool GroupControl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL getControlModels( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getGroupCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL getGroupByName( const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XChangesNotifier
+ virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesListener >& aListener ) 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);
+
+ // XEventListener
+ using cppu::OPropertySetHelper::disposing;
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& evt ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED(ControlModelContainerBase, ControlModel_Base, "toolkit.ControlModelContainerBase" )
+
+ // XInitialization
+ virtual void SAL_CALL initialize (const com::sun::star::uno::Sequence<com::sun::star::uno::Any>& rArguments)
+ throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::tab::XTabPageModel
+ virtual ::sal_Int16 SAL_CALL getTabPageID() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getEnabled() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTooltip() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
+ void stopControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
+
+ void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor );
+
+ void implUpdateGroupStructure();
+};
+
+class ResourceListener :public ::com::sun::star::util::XModifyListener,
+ public ::cppu::OWeakObject,
+ public ::cppu::BaseMutex
+{
+ public:
+ ResourceListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener );
+ virtual ~ResourceListener();
+
+ void startListening( const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver >& rResource );
+ void stopListening();
+
+ // 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 ();
+
+ // 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);
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver > m_xResource;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener;
+ bool m_bListening;
+};
+
+typedef ::cppu::AggImplInheritanceHelper2 < UnoControlContainer
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::util::XChangesListener
+ > ContainerControl_IBase;
+
+class ControlContainerBase : public ContainerControl_IBase
+{
+protected:
+ bool mbSizeModified;
+ bool mbPosModified;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener;
+
+ void ImplInsertControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel, const ::rtl::OUString& rName );
+ void ImplRemoveControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel );
+ virtual void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl );
+ void ImplUpdateResourceResolver();
+ void ImplStartListingForResourceEvents();
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > Impl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL );
+public:
+ ControlContainerBase();
+ ~ControlContainerBase();
+
+ DECLIMPL_SERVICEINFO_DERIVED( ControlContainerBase, UnoControlBase, "toolkit.ControlContainerBase" )
+
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XContainerListener
+ void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XChangesListener
+ virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
+protected:
+ virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+ virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+};
+#endif
diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
index f6a0f768bc10..a68760715035 100644
--- a/toolkit/inc/toolkit/controls/dialogcontrol.hxx
+++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
@@ -28,221 +28,55 @@
#ifndef TOOLKIT_DIALOG_CONTROL_HXX
#define TOOLKIT_DIALOG_CONTROL_HXX
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/container/XContainer.hpp>
-#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <toolkit/controls/controlmodelcontainerbase.hxx>
#include <com/sun/star/awt/XTopWindow.hpp>
-#include <com/sun/star/util/XChangesNotifier.hpp>
-#include <com/sun/star/util/XChangesListener.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
-#include <com/sun/star/beans/XPropertyChangeListener.hpp>
-#include <com/sun/star/awt/XDialog2.hpp>
+#include <com/sun/star/awt/XDialog.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
-#include <cppuhelper/implbase6.hxx>
-#include <cppuhelper/implbase5.hxx>
-#include <toolkit/helper/listenermultiplexer.hxx>
-#include <toolkit/controls/unocontrolmodel.hxx>
#include "toolkit/helper/servicenames.hxx"
#include "toolkit/helper/macros.hxx"
#include <toolkit/controls/unocontrolcontainer.hxx>
-#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/basemutex.hxx>
#include <list>
// ----------------------------------------------------
// class UnoControlDialogModel
// ----------------------------------------------------
-typedef UnoControlModel UnoControlDialogModel_Base;
-typedef ::cppu::ImplHelper6 < ::com::sun::star::lang::XMultiServiceFactory
- , ::com::sun::star::container::XContainer
- , ::com::sun::star::container::XNameContainer
- , ::com::sun::star::awt::XTabControllerModel
- , ::com::sun::star::util::XChangesNotifier
- , ::com::sun::star::beans::XPropertyChangeListener
- > UnoControlDialogModel_IBase;
-class UnoControlDialogModel : public UnoControlDialogModel_IBase
- , public UnoControlDialogModel_Base
+class UnoControlDialogModel : public ControlModelContainerBase
{
-public:
- // would like to make this typedef private, too, but the Forte 7 compiler does have
- // problems with this .....
- typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >, ::rtl::OUString >
- UnoControlModelHolder;
-private:
- typedef ::std::list< UnoControlModelHolder > UnoControlModelHolderList;
-
- // for grouping control models (XTabControllerModel::getGroupXXX)
- typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >
- ModelGroup;
- typedef ::std::vector< ModelGroup > AllGroups;
-
- friend struct CloneControlModel;
- friend struct FindControlModel;
- friend struct CompareControlModel;
-
-private:
- ContainerListenerMultiplexer maContainerListeners;
- ::cppu::OInterfaceContainerHelper maChangeListeners;
- UnoControlModelHolderList maModels;
-
- AllGroups maGroups;
- sal_Bool mbGroupsUpToDate;
-
protected:
::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-
- UnoControlModelHolderList::iterator ImplFindElement( const ::rtl::OUString& rName );
-
public:
UnoControlDialogModel();
UnoControlDialogModel( const UnoControlDialogModel& rModel );
~UnoControlDialogModel();
- UnoControlModel* Clone() const;
-
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlModel::queryInterface(rType); }
- ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
- void SAL_CALL release() throw() { OWeakAggObject::release(); }
-
- // ::com::sun::star::lang::XTypeProvider
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::container::XContainer
- void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::container::XElementAcces
- ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
- sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::container::XIndexContainer, XIndexReplace, XIndexAcces
- // 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) = 0;
- // sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException) = 0;
- // ::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) = 0;
- // void SAL_CALL insertByIndex( 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) = 0;
- // void SAL_CALL removeByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
-
- // ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
- void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException);
- sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
// ::com::sun::star::beans::XMultiPropertySet
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::lang::XMultiServiceFactory
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
// ::com::sun::star::io::XPersistObject
::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
- // XComponent
- void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XTabControllerModel
- virtual sal_Bool SAL_CALL getGroupControl( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setGroupControl( sal_Bool GroupControl ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL getControlModels( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getGroupCount( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL getGroupByName( const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group ) throw (::com::sun::star::uno::RuntimeException);
-
- // XChangesNotifier
- virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesListener >& aListener ) 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);
-
- // XEventListener
- using cppu::OPropertySetHelper::disposing;
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& evt ) throw (::com::sun::star::uno::RuntimeException);
-
// XServiceInfo
- DECLIMPL_SERVICEINFO_DERIVED( UnoControlDialogModel,UnoControlDialogModel_Base, szServiceName2_UnoControlDialogModel )
-
-protected:
- void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
- void stopControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
-
- void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor );
-
- void implUpdateGroupStructure();
-};
-
-// ----------------------------------------------------
-// class UnoDialogControl
-// ----------------------------------------------------
-typedef ::cppu::ImplHelper6 < ::com::sun::star::container::XContainerListener
- , ::com::sun::star::awt::XTopWindow
- , ::com::sun::star::awt::XDialog2
- , ::com::sun::star::util::XChangesListener
- , ::com::sun::star::util::XModifyListener
- , ::com::sun::star::awt::XWindowListener
- > UnoDialogControl_IBase;
-
-class ResourceListener :public ::com::sun::star::util::XModifyListener,
- public ::cppu::OWeakObject,
- public ::cppu::BaseMutex
-{
- public:
- ResourceListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener );
- virtual ~ResourceListener();
-
- void startListening( const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver >& rResource );
- void stopListening();
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlDialogModel, ControlModelContainerBase, szServiceName2_UnoControlDialogModel )
- // 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 ();
-
- // 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);
-
- private:
- ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver > m_xResource;
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener;
- bool m_bListening;
};
-class UnoDialogControl :public UnoControlContainer
- ,public UnoDialogControl_IBase
+class UnoDialogControl :public ControlContainerBase,
+ public ::com::sun::star::awt::XTopWindow,
+ public ::com::sun::star::awt::XDialog,
+ public ::com::sun::star::awt::XWindowListener
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar > mxMenuBar;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController;
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener;
TopWindowListenerMultiplexer maTopWindowListeners;
bool mbWindowListener;
- bool mbSizeModified;
- bool mbPosModified;
-
-protected:
-
- void ImplInsertControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel, const ::rtl::OUString& rName );
- void ImplRemoveControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel );
- void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl );
- void ImplUpdateResourceResolver();
- void ImplStartListingForResourceEvents();
public:
- UnoDialogControl();
+ UnoDialogControl();
+ ~UnoDialogControl();
::rtl::OUString GetComponentServiceName();
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlContainer::queryInterface(rType); }
@@ -267,15 +101,6 @@ public:
virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::container::XContainerListener
- void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::awt::XDialog2
- virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setHelpId( const rtl::OUString& Id ) throw (::com::sun::star::uno::RuntimeException);
-
// ::com::sun::star::awt::XDialog
void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException);
::rtl::OUString SAL_CALL getTitle() throw(::com::sun::star::uno::RuntimeException);
@@ -288,10 +113,6 @@ public:
// ::com::sun::star::awt::XControl
sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
-
- // XChangesListener
- virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
// XModifyListener
virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
@@ -300,13 +121,10 @@ public:
DECLIMPL_SERVICEINFO( UnoDialogControl, szServiceName2_UnoControlDialog )
protected:
- virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
+ // virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
-
+ virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
protected:
- virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
- virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
};
-
#endif // TOOLKIT_DIALOG_CONTROL_HXX
diff --git a/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx b/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx
index 05b3016e690a..558d145f3d14 100644
--- a/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx
+++ b/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx
@@ -186,6 +186,7 @@ FORWARD_DECLARE_INTERFACE( script, XNameContainer )
{
public:
OGeometryControlModel();
+ OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & i_xCompContext);
private:
OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance);
diff --git a/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx b/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx
index d6491877c7ad..3b784251b65e 100644
--- a/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx
+++ b/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx
@@ -37,6 +37,12 @@ OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel()
{
}
+template <class CONTROLMODEL>
+OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & i_xCompContext)
+ :OGeometryControlModel_Base(new CONTROLMODEL(i_xCompContext))
+{
+}
+
//--------------------------------------------------------------------
template <class CONTROLMODEL>
OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance)
diff --git a/toolkit/inc/toolkit/controls/spinningprogress.hxx b/toolkit/inc/toolkit/controls/spinningprogress.hxx
new file mode 100755
index 000000000000..b2e8204ca999
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/spinningprogress.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ * 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 TOOLKIT_SPINNINGPROGRESS_HXX
+#define TOOLKIT_SPINNINGPROGRESS_HXX
+
+#include "toolkit/controls/animatedimages.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= SpinningProgressControlModel
+ //==================================================================================================================
+ typedef AnimatedImagesControlModel SpinningProgressControlModel_Base;
+ class SpinningProgressControlModel : public SpinningProgressControlModel_Base
+ {
+ public:
+ SpinningProgressControlModel();
+ SpinningProgressControlModel( const SpinningProgressControlModel& i_copySource );
+
+ virtual UnoControlModel* Clone() const;
+
+ // XPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ protected:
+ ~SpinningProgressControlModel();
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // TOOLKIT_SPINNINGPROGRESS_HXX
diff --git a/toolkit/inc/toolkit/controls/tabpagecontainer.hxx b/toolkit/inc/toolkit/controls/tabpagecontainer.hxx
new file mode 100644
index 000000000000..6861f4bc01bb
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/tabpagecontainer.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * 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 TOOLKIT_TABPAGE_CONTAINER_HXX
+#define TOOLKIT_TABPAGE_CONTAINER_HXX
+
+#include <com/sun/star/awt/tab/XTabPageContainer.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainerModel.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainerListener.hpp>
+#include <com/sun/star/awt/tab/XTabPage.hpp>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/sequence.hxx>
+#include <toolkit/controls/controlmodelcontainerbase.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+using namespace ::com::sun::star::uno;
+//using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+
+// ------------------------------------------------------------------
+// class ::com::sun::star::awt::tab::UnoControlTabPageContainerModel
+// ------------------------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel
+ , ::com::sun::star::awt::tab::XTabPageContainerModel
+ > UnoControlTabPageContainerModel_Base;
+class UnoControlTabPageContainerModel : public UnoControlTabPageContainerModel_Base
+{
+private:
+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageModel > > m_aTabPageVector;
+ ContainerListenerMultiplexer maContainerListeners;
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+public:
+ UnoControlTabPageContainerModel();
+ UnoControlTabPageContainerModel( const UnoControlTabPageContainerModel& rModel ) : UnoControlTabPageContainerModel_Base( rModel ),maContainerListeners( *this ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlTabPageContainerModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainerModel, UnoControlModel, szServiceName_UnoControlTabPageContainerModel )
+ // XIndexContainer
+ virtual void SAL_CALL insertByIndex( 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);
+ virtual void SAL_CALL removeByIndex( sal_Int32 Index )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // 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);
+ //{
+ //return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0);
+ //}
+
+ virtual sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XContainer
+ void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+};
+// ===================================================================
+// = UnoControlTabPageContainer
+// ===================================================================
+typedef ::cppu::AggImplInheritanceHelper1 < ControlContainerBase
+ , ::com::sun::star::awt::tab::XTabPageContainer
+ > UnoControlTabPageContainer_Base;
+class UnoControlTabPageContainer : public UnoControlTabPageContainer_Base
+{
+public:
+ UnoControlTabPageContainer();
+ ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::tab::XTabPageContainer
+ virtual ::sal_Int16 SAL_CALL getActiveTabPageID() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getTabPageCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isTabPageActive( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPage( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPageByID( ::sal_Int16 tabPageID ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addControl( const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& Control ) throw (::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainer, UnoControlBase, szServiceName_UnoControlTabPageContainer )
+
+// using UnoControl::getPeer;
+protected:
+ virtual void updateFromModel();
+private:
+ TabPageListenerMultiplexer m_aTabPageListeners;
+ sal_Int16 m_nActiveTabPageId;
+};
+
+#endif // _TOOLKIT_TABPAGE_CONTAINER_HXX
diff --git a/toolkit/inc/toolkit/controls/tabpagemodel.hxx b/toolkit/inc/toolkit/controls/tabpagemodel.hxx
new file mode 100644
index 000000000000..76edc2e68026
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/tabpagemodel.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * 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 TOOLKIT_TABPAGE_MODEL_HXX
+#define TOOLKIT_TABPAGE_MODEL_HXX
+
+#include <toolkit/controls/controlmodelcontainerbase.hxx>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/awt/tab/XTabPage.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include "toolkit/helper/servicenames.hxx"
+#include "toolkit/helper/macros.hxx"
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <list>
+#include <cppuhelper/implbase2.hxx>
+
+// ----------------------------------------------------
+// class TabPageModel
+// ----------------------------------------------------
+//typedef ::cppu::ImplHelper2< ::com::sun::star::awt::tab::XTabPageModel,
+// ::com::sun::star::lang::XInitialization
+// > TabPageAccess_BASE;
+//
+//class TabPageModel : public TabPageAccess_BASE
+//{
+//
+//private:
+// bool m_bEnabled;
+// ::rtl::OUString m_sTitle;
+// ::rtl::OUString m_sImageURL;
+// ::rtl::OUString m_sTooltip;
+// sal_Int16 m_nTabPageId;
+//
+//public:
+// TabPageModel();
+// explicit TabPageModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xCompContext);
+// ~TabPageModel();
+//
+// // XInitialization
+// virtual void SAL_CALL initialize (const com::sun::star::uno::Sequence<com::sun::star::uno::Any>& rArguments)
+// throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
+//
+// ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+// void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+// void SAL_CALL release() throw() { OWeakAggObject::release(); }
+//
+// // ::com::sun::star::lang::XTypeProvider
+// //::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+// //::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+//
+// // ::com::sun::star::awt::tab::XTabPageModel
+// virtual ::sal_Int16 SAL_CALL getTabPageID() throw (::com::sun::star::uno::RuntimeException);
+// virtual ::sal_Bool SAL_CALL getEnabled() throw (::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException);
+// virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException);
+// virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException);
+// virtual ::rtl::OUString SAL_CALL getTooltip() throw (::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException);
+//};
+// ----------------------------------------------------
+// class UnoControlTabPageModel
+// ----------------------------------------------------
+
+class UnoControlTabPageModel : public ControlModelContainerBase
+ //public TabPageModel
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xCompContext;
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+public:
+ UnoControlTabPageModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & i_xCompContext);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XInitialization
+ virtual void SAL_CALL initialize (const com::sun::star::uno::Sequence<com::sun::star::uno::Any>& rArguments)
+ throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageModel, ControlModelContainerBase, szServiceName_UnoControlTabPageModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoTabPageControl
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper2 < ControlContainerBase
+ , ::com::sun::star::awt::tab::XTabPage
+ , ::com::sun::star::awt::XWindowListener
+ > UnoControlTabPage_Base;
+class UnoControlTabPage : public UnoControlTabPage_Base
+{
+private:
+ bool m_bWindowListener;
+public:
+
+ UnoControlTabPage();
+ ~UnoControlTabPage();
+ ::rtl::OUString GetComponentServiceName();
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindowListener
+ virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlTabPage, szServiceName_UnoControlTabPage)
+};
+
+#endif // TOOLKIT_TABPAGE_MODEL_HXX
diff --git a/toolkit/inc/toolkit/controls/tksimpleanimation.hxx b/toolkit/inc/toolkit/controls/tksimpleanimation.hxx
index 697d1679af45..1d059c749902 100644
--- a/toolkit/inc/toolkit/controls/tksimpleanimation.hxx
+++ b/toolkit/inc/toolkit/controls/tksimpleanimation.hxx
@@ -71,11 +71,11 @@ namespace toolkit
//= UnoSimpleAnimationControl
//====================================================================
- typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSimpleAnimation
- > UnoSimpleAnimationControl_Base;
+ typedef ::cppu::AggImplInheritanceHelper1 < UnoControlBase
+ , ::com::sun::star::awt::XSimpleAnimation
+ > UnoSimpleAnimationControl_Base;
- class UnoSimpleAnimationControl :public UnoControlBase
- ,public UnoSimpleAnimationControl_Base
+ class UnoSimpleAnimationControl : public UnoSimpleAnimationControl_Base
{
private:
@@ -83,16 +83,6 @@ namespace toolkit
UnoSimpleAnimationControl();
::rtl::OUString GetComponentServiceName();
- DECLARE_UNO3_AGG_DEFAULTS( UnoSimpleAnimationControl, UnoControlBase );
- ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-
- void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
- void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XTypeProvider
- DECLARE_XTYPEPROVIDER()
-
// XSimpleAnimation
virtual void SAL_CALL start() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL stop() throw (::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx
index 01ff047ee3de..5e34c23279a1 100644
--- a/toolkit/inc/toolkit/controls/unocontrols.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrols.hxx
@@ -1501,5 +1501,6 @@ public:
};
+
#endif // _TOOLKIT_HELPER_UNOCONTROLS_HXX_
diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
index b4151fe0f35e..408dd4cbe385 100644
--- a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
+++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
@@ -55,6 +55,7 @@
#include <toolkit/helper/mutexhelper.hxx>
#include <toolkit/helper/macros.hxx>
#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainerListener.hpp>
// ----------------------------------------------------
// class ListenerMultiplexerBase
// ----------------------------------------------------
@@ -251,5 +252,12 @@ DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer, ::com::sun:
void SAL_CALL selectionChanged( const ::com::sun::star::awt::grid::GridSelectionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
DECL_LISTENERMULTIPLEXER_END
+// ----------------------------------------------------
+// class TabPageListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener )
+ void SAL_CALL tabPageActivated( const ::com::sun::star::awt::tab::TabPageActivatedEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
#endif // _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
diff --git a/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx b/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx
index c84a6e54d73b..45e0bdf93dc4 100644
--- a/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx
+++ b/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx
@@ -44,7 +44,7 @@ public:
::cppu::OBroadcastHelper BrdcstHelper;
::osl::Mutex& GetMutex() { return Mutex; }
-
+ ::cppu::OBroadcastHelper& GetBroadcastHelper() { return BrdcstHelper; }
};
diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
index 837d283f4e8c..082ac75bafae 100644
--- a/toolkit/inc/toolkit/helper/property.hxx
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -202,6 +202,7 @@ namespace rtl {
#define BASEPROPERTY_GRID_ROW_BACKGROUND 151
#define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152
#define BASEPROPERTY_ITEM_SEPARATOR_POS 153
+#define BASEPROPERTY_AUTO_REPEAT 154
// Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx
index 2d1df79b733b..1e5d394fb660 100644
--- a/toolkit/inc/toolkit/helper/servicenames.hxx
+++ b/toolkit/inc/toolkit/helper/servicenames.hxx
@@ -102,7 +102,17 @@ extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szSe
extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[], szServiceName2_UnoSimpleAnimationControlModel[];
extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName2_UnoThrobberControl[];
extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[], szServiceName2_UnoThrobberControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_AnimatedImagesControl[];
+extern const sal_Char __FAR_DATA szServiceName_AnimatedImagesControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_SpinningProgressControlModel[];
extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTabPageModel[], szServiceName2_UnoControlTabPageModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTabPage[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainerModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainer[];
+
+// ExtUnoWrapper:
+extern const char __FAR_DATA szServiceName_ImageProducer[], szServiceName2_ImageProducer[];
#endif // _TOOLKIT_HELPER_SERVICENAMES_HXX_
diff --git a/toolkit/inc/toolkit/helper/throbberimpl.hxx b/toolkit/inc/toolkit/helper/throbberimpl.hxx
deleted file mode 100644
index b944a74b65d2..000000000000
--- a/toolkit/inc/toolkit/helper/throbberimpl.hxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/*************************************************************************
- *
- * 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 _TOOLKIT_HELPER_THROBBERIMPL_HXX_
-#define _TOOLKIT_HELPER_THROBBERIMPL_HXX_
-
-#include <toolkit/awt/vclxwindow.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-
-#include <com/sun/star/graphic/XGraphic.hpp>
-#include <vcl/timer.hxx>
-#include <vos/mutex.hxx>
-
-//........................................................................
-namespace toolkit
-//........................................................................
-{
-
- class Throbber_Impl
- {
- private:
- vos::IMutex& mrMutex; // Reference to SolarMutex
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > maImageList;
- ::com::sun::star::uno::Reference< VCLXWindow > mxParent;
-
- sal_Bool mbRepeat;
- sal_Int32 mnStepTime;
- sal_Int32 mnCurStep;
- sal_Int32 mnStepCount;
- AutoTimer maWaitTimer;
-
- DECL_LINK( TimeOutHdl, Throbber_Impl* );
-
- vos::IMutex& GetMutex() { return mrMutex; }
-
- public:
- Throbber_Impl( ::com::sun::star::uno::Reference< VCLXWindow > xParent,
- sal_Int32 nStepTime,
- sal_Bool bRepeat );
- ~Throbber_Impl();
-
- // Properties
- void setStepTime( sal_Int32 nStepTime ) { mnStepTime = nStepTime; }
- void setRepeat( sal_Bool bRepeat ) { mbRepeat = bRepeat; }
-
- // XSimpleAnimation
- void start() throw ( ::com::sun::star::uno::RuntimeException );
- void stop() throw ( ::com::sun::star::uno::RuntimeException );
- void setImageList( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& ImageList )
- throw ( ::com::sun::star::uno::RuntimeException );
- // Helpers
- void initImage() throw ( ::com::sun::star::uno::RuntimeException );
- sal_Bool isHCMode() throw ( ::com::sun::star::uno::RuntimeException );
- };
-//........................................................................
-} // namespacetoolkit
-//........................................................................
-
-#endif //_TOOLKIT_HELPER_THROBBERIMPL_HXX_
-
diff --git a/toolkit/inc/toolkit/helper/tkresmgr.hxx b/toolkit/inc/toolkit/helper/tkresmgr.hxx
index d7a1c42ea13c..ea62cd3db361 100644
--- a/toolkit/inc/toolkit/helper/tkresmgr.hxx
+++ b/toolkit/inc/toolkit/helper/tkresmgr.hxx
@@ -70,6 +70,7 @@ public:
// loads the image with the specified resource id
static Image loadImage( sal_uInt16 nResId );
+ static Image getImageFromURL( const ::rtl::OUString& i_rImageURL );
};
diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx
new file mode 100755
index 000000000000..c9c640d51c60
--- /dev/null
+++ b/toolkit/source/awt/animatedimagespeer.cxx
@@ -0,0 +1,538 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_toolkit.hxx"
+
+#include "toolkit/awt/animatedimagespeer.hxx"
+#include "toolkit/helper/property.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XAnimatedImages.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/processfactory.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/urlobj.hxx>
+#include <vcl/throbber.hxx>
+
+#include <limits>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::container::ContainerEvent;
+ using ::com::sun::star::awt::XAnimatedImages;
+ using ::com::sun::star::awt::Size;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::graphic::XGraphicProvider;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::graphic::XGraphic;
+ /** === end UNO using === **/
+ namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
+
+ //==================================================================================================================
+ //= AnimatedImagesPeer_Data
+ //==================================================================================================================
+ struct CachedImage
+ {
+ ::rtl::OUString sImageURL;
+ mutable Reference< XGraphic > xGraphic;
+
+ CachedImage()
+ :sImageURL()
+ ,xGraphic()
+ {
+ }
+
+ CachedImage( ::rtl::OUString const& i_imageURL )
+ :sImageURL( i_imageURL )
+ ,xGraphic()
+ {
+ }
+ };
+
+ struct AnimatedImagesPeer_Data
+ {
+ AnimatedImagesPeer& rAntiImpl;
+ ::std::vector< ::std::vector< CachedImage > > aCachedImageSets;
+
+ AnimatedImagesPeer_Data( AnimatedImagesPeer& i_antiImpl )
+ :rAntiImpl( i_antiImpl )
+ ,aCachedImageSets()
+ {
+ }
+ };
+
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString lcl_getHighContrastURL( ::rtl::OUString const& i_imageURL )
+ {
+ INetURLObject aURL( i_imageURL );
+ if ( aURL.GetProtocol() != INET_PROT_PRIV_SOFFICE )
+ {
+ OSL_VERIFY( aURL.insertName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hicontrast" ) ), false, 0 ) );
+ return aURL.GetMainURL( INetURLObject::NO_DECODE );
+ }
+ // the private: scheme is not considered to be hierarchical by INetURLObject, so manually insert the
+ // segment
+ const sal_Int32 separatorPos = i_imageURL.indexOf( '/' );
+ ENSURE_OR_RETURN( separatorPos != -1, "lcl_getHighContrastURL: unsipported URL scheme - cannot automatically determine HC version!", i_imageURL );
+
+ ::rtl::OUStringBuffer composer;
+ composer.append( i_imageURL.copy( 0, separatorPos ) );
+ composer.appendAscii( "/hicontrast" );
+ composer.append( i_imageURL.copy( separatorPos ) );
+ return composer.makeStringAndClear();
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ bool lcl_ensureImage_throw( Reference< XGraphicProvider > const& i_graphicProvider, const bool i_isHighContrast, const CachedImage& i_cachedImage )
+ {
+ if ( !i_cachedImage.xGraphic.is() )
+ {
+ ::comphelper::NamedValueCollection aMediaProperties;
+ if ( i_isHighContrast )
+ {
+ // try (to find) the high-contrast version of the graphic first
+ aMediaProperties.put( "URL", lcl_getHighContrastURL( i_cachedImage.sImageURL ) );
+ i_cachedImage.xGraphic.set( i_graphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY );
+ }
+ if ( !i_cachedImage.xGraphic.is() )
+ {
+ aMediaProperties.put( "URL", i_cachedImage.sImageURL );
+ i_cachedImage.xGraphic.set( i_graphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY );
+ }
+ }
+ return i_cachedImage.xGraphic.is();
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ Size lcl_getGraphicSizePixel( Reference< XGraphic > const& i_graphic )
+ {
+ Size aSizePixel;
+ try
+ {
+ if ( i_graphic.is() )
+ {
+ const Reference< XPropertySet > xGraphicProps( i_graphic, UNO_QUERY_THROW );
+ OSL_VERIFY( xGraphicProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SizePixel" ) ) ) >>= aSizePixel );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return aSizePixel;
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void lcl_init( Sequence< ::rtl::OUString > const& i_imageURLs, ::std::vector< CachedImage >& o_images )
+ {
+ o_images.resize(0);
+ size_t count = size_t( i_imageURLs.getLength() );
+ o_images.reserve( count );
+ for ( size_t i = 0; i < count; ++i )
+ {
+ o_images.push_back( CachedImage( i_imageURLs[i] ) );
+ }
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void lcl_updateImageList_nothrow( AnimatedImagesPeer_Data& i_data )
+ {
+ Throbber* pThrobber = dynamic_cast< Throbber* >( i_data.rAntiImpl.GetWindow() );
+ if ( pThrobber == NULL )
+ return;
+
+ try
+ {
+ // collect the image sizes of the different image sets
+ const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW );
+
+ const bool isHighContrast = pThrobber->GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ sal_Int32 nPreferredSet = -1;
+ const size_t nImageSetCount = i_data.aCachedImageSets.size();
+ if ( nImageSetCount < 2 )
+ {
+ nPreferredSet = sal_Int32( nImageSetCount ) - 1;
+ }
+ else
+ {
+ ::std::vector< Size > aImageSizes( nImageSetCount );
+ for ( sal_Int32 nImageSet = 0; size_t( nImageSet ) < nImageSetCount; ++nImageSet )
+ {
+ ::std::vector< CachedImage > const& rImageSet( i_data.aCachedImageSets[ nImageSet ] );
+ if ( ( rImageSet.empty() )
+ || ( !lcl_ensureImage_throw( xGraphicProvider, isHighContrast, rImageSet[0] ) )
+ )
+ {
+ aImageSizes[ nImageSet ] = Size( ::std::numeric_limits< long >::max(), ::std::numeric_limits< long >::max() );
+ }
+ else
+ {
+ aImageSizes[ nImageSet ] = lcl_getGraphicSizePixel( rImageSet[0].xGraphic );
+ }
+ }
+
+ // find the set with the smallest difference between window size and image size
+ const ::Size aWindowSizePixel = pThrobber->GetSizePixel();
+ long nMinimalDistance = ::std::numeric_limits< long >::max();
+ for ( ::std::vector< Size >::const_iterator check = aImageSizes.begin();
+ check != aImageSizes.end();
+ ++check
+ )
+ {
+ if ( ( check->Width > aWindowSizePixel.Width() )
+ || ( check->Height > aWindowSizePixel.Height() )
+ )
+ // do not use an image set which doesn't fit into the window
+ continue;
+
+ const sal_Int64 distance =
+ ( aWindowSizePixel.Width() - check->Width ) * ( aWindowSizePixel.Width() - check->Width )
+ + ( aWindowSizePixel.Height() - check->Height ) * ( aWindowSizePixel.Height() - check->Height );
+ if ( distance < nMinimalDistance )
+ {
+ nMinimalDistance = distance;
+ nPreferredSet = check - aImageSizes.begin();
+ }
+ }
+ }
+
+ // found a set?
+ Sequence< Reference< XGraphic > > aImages;
+ if ( ( nPreferredSet >= 0 ) && ( size_t( nPreferredSet ) < nImageSetCount ) )
+ {
+ // => set the images
+ ::std::vector< CachedImage > const& rImageSet( i_data.aCachedImageSets[ nPreferredSet ] );
+ aImages.realloc( rImageSet.size() );
+ sal_Int32 imageIndex = 0;
+ for ( ::std::vector< CachedImage >::const_iterator cachedImage = rImageSet.begin();
+ cachedImage != rImageSet.end();
+ ++cachedImage, ++imageIndex
+ )
+ {
+ lcl_ensureImage_throw( xGraphicProvider, isHighContrast, *cachedImage );
+ aImages[ imageIndex ] = cachedImage->xGraphic;
+ }
+ }
+ pThrobber->setImageList( aImages );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void lcl_updateImageList_nothrow( AnimatedImagesPeer_Data& i_data, const Reference< XAnimatedImages >& i_images )
+ {
+ try
+ {
+ const sal_Int32 nImageSetCount = i_images->getImageSetCount();
+ i_data.aCachedImageSets.resize(0);
+ for ( sal_Int32 set = 0; set < nImageSetCount; ++set )
+ {
+ const Sequence< ::rtl::OUString > aImageURLs( i_images->getImageSet( set ) );
+ ::std::vector< CachedImage > aImages;
+ lcl_init( aImageURLs, aImages );
+ i_data.aCachedImageSets.push_back( aImages );
+ }
+
+ lcl_updateImageList_nothrow( i_data );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ //==================================================================================================================
+ //= AnimatedImagesPeer
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ AnimatedImagesPeer::AnimatedImagesPeer()
+ :AnimatedImagesPeer_Base()
+ ,m_pData( new AnimatedImagesPeer_Data( *this ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AnimatedImagesPeer::~AnimatedImagesPeer()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::startAnimation( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->start();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::stopAnimation( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->stop();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL AnimatedImagesPeer::isAnimationRunning( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ return pThrobber->isRunning();
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::setProperty( const ::rtl::OUString& i_propertyName, const Any& i_value ) throw(RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber == NULL )
+ {
+ VCLXWindow::setProperty( i_propertyName, i_value );
+ return;
+ }
+
+ const sal_uInt16 nPropertyId = GetPropertyId( i_propertyName );
+ switch ( nPropertyId )
+ {
+ case BASEPROPERTY_STEP_TIME:
+ {
+ sal_Int32 nStepTime( 0 );
+ if ( i_value >>= nStepTime )
+ pThrobber->setStepTime( nStepTime );
+ break;
+ }
+ case BASEPROPERTY_AUTO_REPEAT:
+ {
+ sal_Bool bRepeat( sal_True );
+ if ( i_value >>= bRepeat )
+ pThrobber->setRepeat( bRepeat );
+ break;
+ }
+
+ case BASEPROPERTY_IMAGE_SCALE_MODE:
+ {
+ sal_Int16 nScaleMode( ImageScaleMode::Anisotropic );
+ ImageControl* pImageControl = dynamic_cast< ImageControl* >( GetWindow() );
+ if ( pImageControl && ( i_value >>= nScaleMode ) )
+ {
+ pImageControl->SetScaleMode( nScaleMode );
+ }
+ }
+ break;
+
+ default:
+ AnimatedImagesPeer_Base::setProperty( i_propertyName, i_value );
+ break;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL AnimatedImagesPeer::getProperty( const ::rtl::OUString& i_propertyName ) throw(RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Any aReturn;
+
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber == NULL )
+ return VCLXWindow::getProperty( i_propertyName );
+
+ const sal_uInt16 nPropertyId = GetPropertyId( i_propertyName );
+ switch ( nPropertyId )
+ {
+ case BASEPROPERTY_STEP_TIME:
+ aReturn <<= pThrobber->getStepTime();
+ break;
+
+ case BASEPROPERTY_AUTO_REPEAT:
+ aReturn <<= pThrobber->getRepeat();
+ break;
+
+ case BASEPROPERTY_IMAGE_SCALE_MODE:
+ {
+ ImageControl const* pImageControl = dynamic_cast< ImageControl* >( GetWindow() );
+ aReturn <<= ( pImageControl ? pImageControl->GetScaleMode() : ImageScaleMode::Anisotropic );
+ }
+ break;
+
+ default:
+ aReturn = AnimatedImagesPeer_Base::getProperty( i_propertyName );
+ break;
+ }
+
+ return aReturn;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AnimatedImagesPeer::ProcessWindowEvent( const VclWindowEvent& i_windowEvent )
+ {
+ switch ( i_windowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_RESIZE:
+ lcl_updateImageList_nothrow( *m_pData );
+ break;
+ }
+
+ AnimatedImagesPeer_Base::ProcessWindowEvent( i_windowEvent );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AnimatedImagesPeer::impl_updateImages_nolck( const Reference< XInterface >& i_animatedImages )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ lcl_updateImageList_nothrow( *m_pData, Reference< XAnimatedImages >( i_animatedImages, UNO_QUERY_THROW ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Reference< XAnimatedImages > xAnimatedImages( i_event.Source, UNO_QUERY_THROW );
+
+ sal_Int32 nPosition(0);
+ OSL_VERIFY( i_event.Accessor >>= nPosition );
+ size_t position = size_t( nPosition );
+ if ( position > m_pData->aCachedImageSets.size() )
+ {
+ OSL_ENSURE( false, "AnimatedImagesPeer::elementInserted: illegal accessor/index!" );
+ lcl_updateImageList_nothrow( *m_pData, xAnimatedImages );
+ }
+
+ Sequence< ::rtl::OUString > aImageURLs;
+ OSL_VERIFY( i_event.Element >>= aImageURLs );
+ ::std::vector< CachedImage > aImages;
+ lcl_init( aImageURLs, aImages );
+ m_pData->aCachedImageSets.insert( m_pData->aCachedImageSets.begin() + position, aImages );
+ lcl_updateImageList_nothrow( *m_pData );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Reference< XAnimatedImages > xAnimatedImages( i_event.Source, UNO_QUERY_THROW );
+
+ sal_Int32 nPosition(0);
+ OSL_VERIFY( i_event.Accessor >>= nPosition );
+ size_t position = size_t( nPosition );
+ if ( position >= m_pData->aCachedImageSets.size() )
+ {
+ OSL_ENSURE( false, "AnimatedImagesPeer::elementRemoved: illegal accessor/index!" );
+ lcl_updateImageList_nothrow( *m_pData, xAnimatedImages );
+ }
+
+ m_pData->aCachedImageSets.erase( m_pData->aCachedImageSets.begin() + position );
+ lcl_updateImageList_nothrow( *m_pData );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Reference< XAnimatedImages > xAnimatedImages( i_event.Source, UNO_QUERY_THROW );
+
+ sal_Int32 nPosition(0);
+ OSL_VERIFY( i_event.Accessor >>= nPosition );
+ size_t position = size_t( nPosition );
+ if ( position >= m_pData->aCachedImageSets.size() )
+ {
+ OSL_ENSURE( false, "AnimatedImagesPeer::elementReplaced: illegal accessor/index!" );
+ lcl_updateImageList_nothrow( *m_pData, xAnimatedImages );
+ }
+
+ Sequence< ::rtl::OUString > aImageURLs;
+ OSL_VERIFY( i_event.Element >>= aImageURLs );
+ ::std::vector< CachedImage > aImages;
+ lcl_init( aImageURLs, aImages );
+ m_pData->aCachedImageSets[ position ] = aImages;
+ lcl_updateImageList_nothrow( *m_pData );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::disposing( const EventObject& i_event ) throw (RuntimeException)
+ {
+ VCLXWindow::disposing( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::modified( const EventObject& i_event ) throw (RuntimeException)
+ {
+ impl_updateImages_nolck( i_event.Source );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::dispose( ) throw(RuntimeException)
+ {
+ AnimatedImagesPeer_Base::dispose();
+ ::vos::OGuard aGuard( GetMutex() );
+ m_pData->aCachedImageSets.resize(0);
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
diff --git a/toolkit/source/awt/vclxtabpagecontainer.cxx b/toolkit/source/awt/vclxtabpagecontainer.cxx
new file mode 100644
index 000000000000..ead570f80b88
--- /dev/null
+++ b/toolkit/source/awt/vclxtabpagecontainer.cxx
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/awt/vclxtabpagecontainer.hxx>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <vcl/tabpage.hxx>
+#include <vcl/tabctrl.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/tkresmgr.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::view;
+// ----------------------------------------------------
+// class VCLXTabPageContainer
+// ----------------------------------------------------
+void VCLXTabPageContainer::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+VCLXTabPageContainer::VCLXTabPageContainer() :
+ m_aTabPageListeners( *this )
+{
+}
+
+VCLXTabPageContainer::~VCLXTabPageContainer()
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s", __FUNCTION__);
+#endif
+}
+
+void SAL_CALL VCLXTabPageContainer::draw( sal_Int32 nX, sal_Int32 nY ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ TabControl* pTabControl = (TabControl*)GetWindow();
+ if ( pTabControl )
+ {
+ TabPage *pTabPage = pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( pTabControl->GetCurPageId( ) ) );
+ if ( pTabPage )
+ {
+ ::Point aPos( nX, nY );
+ ::Size aSize = pTabPage->GetSizePixel();
+
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ aPos = pDev->PixelToLogic( aPos );
+ aSize = pDev->PixelToLogic( aSize );
+
+ pTabPage->Draw( pDev, aPos, aSize, 0 );
+ }
+ }
+
+ VCLXWindow::draw( nX, nY );
+/*
+ if ( pWindow )
+ {
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ if ( !pDev )
+ pDev = pWindow->GetParent();
+
+ Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
+ Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
+
+ pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
+ }
+*/
+}
+
+::com::sun::star::awt::DeviceInfo VCLXTabPageContainer::getInfo() throw(RuntimeException)
+{
+ ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
+ return aInfo;
+}
+
+void SAL_CALL VCLXTabPageContainer::setProperty(const ::rtl::OUString& PropertyName, const Any& Value ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TabControl* pTabPage = (TabControl*)GetWindow();
+ if ( pTabPage )
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+}
+::sal_Int16 SAL_CALL VCLXTabPageContainer::getActiveTabPageID() throw (RuntimeException)
+{
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ return pTabCtrl != NULL ? pTabCtrl->GetCurPageId( ) : 0;
+}
+void SAL_CALL VCLXTabPageContainer::setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (RuntimeException)
+{
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ if ( pTabCtrl )
+ pTabCtrl->SelectTabPage(_activetabpageid);
+}
+::sal_Int32 SAL_CALL VCLXTabPageContainer::getTabPageCount( ) throw (RuntimeException)
+{
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ return pTabCtrl != NULL ? pTabCtrl->GetPageCount() : 0;
+}
+::sal_Bool SAL_CALL VCLXTabPageContainer::isTabPageActive( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
+{
+ return (getActiveTabPageID() == tabPageIndex);
+}
+Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer::getTabPage( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
+{
+ return (tabPageIndex >= 0 && tabPageIndex < static_cast<sal_Int16>(m_aTabPages.size())) ? m_aTabPages[tabPageIndex] : NULL;
+}
+Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer::getTabPageByID( ::sal_Int16 tabPageID ) throw (RuntimeException)
+{
+ ::vos::OClearableGuard aGuard( GetMutex() );
+ Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage;
+ ::std::vector< Reference< ::com::sun::star::awt::tab::XTabPage > >::iterator aIter = m_aTabPages.begin();
+ ::std::vector< Reference< ::com::sun::star::awt::tab::XTabPage > >::iterator aEnd = m_aTabPages.end();
+ for(;aIter != aEnd;++aIter)
+ {
+ Reference< awt::XControl > xControl(*aIter,UNO_QUERY );
+ Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY );
+ if ( tabPageID == xP->getTabPageID() )
+ {
+ xTabPage = *aIter;
+ break;
+ }
+ }
+ return xTabPage;
+}
+void SAL_CALL VCLXTabPageContainer::addTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
+{
+ m_aTabPageListeners.addInterface( listener );
+}
+void SAL_CALL VCLXTabPageContainer::removeTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
+{
+ m_aTabPageListeners.removeInterface( listener );
+}
+
+void VCLXTabPageContainer::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+{
+ ::vos::OClearableGuard aGuard( GetMutex() );
+ TabControl* pTabControl = static_cast< TabControl* >( GetWindow() );
+ if ( pTabControl )
+ {
+ switch ( _rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_TABPAGE_ACTIVATE:
+ {
+// allocateArea( maAllocation );
+ ULONG page = (ULONG)_rVclWindowEvent.GetData();
+ awt::tab::TabPageActivatedEvent aEvent(NULL,page);
+ m_aTabPageListeners.tabPageActivated(aEvent);
+ break;
+ }
+ default:
+ aGuard.clear();
+ VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+ break;
+ }
+ }
+}
+void SAL_CALL VCLXTabPageContainer::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+void SAL_CALL VCLXTabPageContainer::elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage(Event.Element,uno::UNO_QUERY);
+ if ( pTabCtrl && xTabPage.is() )
+ {
+ Reference< awt::XControl > xControl(xTabPage,UNO_QUERY );
+ Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY );
+ sal_Int16 nPageID = xP->getTabPageID();
+
+ Window* pWindow = VCLUnoHelper::GetWindow(xControl->getPeer());
+ TabPage* pPage = (TabPage*)pWindow;
+ pTabCtrl->InsertPage(nPageID,pPage->GetText());
+
+ pPage->Hide();
+ pTabCtrl->SetTabPage(nPageID,pPage);
+ pTabCtrl->SetHelpText(nPageID,xP->getTooltip());
+ pTabCtrl->SetPageImage(nPageID,TkResMgr::getImageFromURL(xP->getImageURL()));
+ pTabCtrl->SelectTabPage(nPageID);
+ m_aTabPages.push_back(xTabPage);
+ }
+}
+void SAL_CALL VCLXTabPageContainer::elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage(Event.Element,uno::UNO_QUERY);
+ if ( pTabCtrl && xTabPage.is() )
+ {
+ Reference< awt::XControl > xControl(xTabPage,UNO_QUERY );
+ Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY );
+ pTabCtrl->RemovePage(xP->getTabPageID());
+ m_aTabPages.erase(::std::remove(m_aTabPages.begin(),m_aTabPages.end(),xTabPage));
+ }
+}
+void SAL_CALL VCLXTabPageContainer::elementReplaced( const ::com::sun::star::container::ContainerEvent& /*Event*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
diff --git a/toolkit/source/awt/vclxtabpagemodel.cxx b/toolkit/source/awt/vclxtabpagemodel.cxx
new file mode 100644
index 000000000000..c7145992bd7f
--- /dev/null
+++ b/toolkit/source/awt/vclxtabpagemodel.cxx
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/awt/vclxtabpagemodel.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/tabctrl.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+// ----------------------------------------------------
+// class VCLXDialog
+// ----------------------------------------------------
+
+VCLXTabPageModel::VCLXTabPageModel()
+{
+}
+
+VCLXTabPageModel::~VCLXTabPageModel()
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s", __FUNCTION__);
+#endif
+}
+
+void SAL_CALL VCLXTabPageModel::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ Window* pWindow = GetWindow();
+
+ if ( pWindow )
+ {
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ if ( !pDev )
+ pDev = pWindow->GetParent();
+
+ Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
+ Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
+
+ pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
+ }
+}
+
+::com::sun::star::awt::DeviceInfo VCLXTabPageModel::getInfo() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::DeviceInfo aInfo;// = VCLXDevice::getInfo();
+ return aInfo;
+}
+
+
+void SAL_CALL VCLXTabPageModel::setProperty(
+ const ::rtl::OUString& /*PropertyName*/,
+ const ::com::sun::star::uno::Any& /*Value*/ )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ /*TabPage* pTabPage = (TabPage*)GetWindow();
+ if ( pTabPage )
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }*/
+}
+//XTabPageModel
+::sal_Int16 SAL_CALL VCLXTabPageModel::getTabPageID() throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0;
+}
+::sal_Bool SAL_CALL VCLXTabPageModel::getEnabled() throw (::com::sun::star::uno::RuntimeException)
+{
+ return false;
+}
+void SAL_CALL VCLXTabPageModel::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //TabControl* pTabControl = (TabControl*)GetWindow();
+ //if ( pTabControl )
+ // pTabControl->EnablePage(0, true);
+}
+::rtl::OUString SAL_CALL VCLXTabPageModel::getTitle() throw (::com::sun::star::uno::RuntimeException)
+{
+ //TabControl* pTabControl = (TabControl*)GetWindow();
+ //if ( pTabControl )
+ // return pTabControl->GetPageText(0);
+ //else
+ return ::rtl::OUString::createFromAscii("");
+}
+void SAL_CALL VCLXTabPageModel::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //TabControl* pTabControl = (TabControl*)GetWindow();
+ //if ( pTabControl )
+ // pTabControl->SetPageText(0, _title);
+
+}
+::rtl::OUString SAL_CALL VCLXTabPageModel::getImageURL() throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii("");
+}
+void SAL_CALL VCLXTabPageModel::setImageURL( const ::rtl::OUString& /*_imageurl*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //m_sImageURL = _imageurl;
+}
+::rtl::OUString SAL_CALL VCLXTabPageModel::getTooltip() throw (::com::sun::star::uno::RuntimeException)
+{
+ //return m_sTooltip;
+ return ::rtl::OUString::createFromAscii("");
+}
+void SAL_CALL VCLXTabPageModel::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)_tooltip;
+}
+::cppu::IPropertyArrayHelper& VCLXTabPageModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXTabPageModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 1af422bf7f00..96370911e9ed 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -33,6 +33,7 @@
#include <tools/svwin.h>
#endif
#include <stdio.h>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
#include <com/sun/star/awt/WindowAttribute.hpp>
#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
#include <com/sun/star/awt/WindowClass.hpp>
@@ -68,9 +69,12 @@
#include <toolkit/awt/vclxsystemdependentwindow.hxx>
#include <toolkit/awt/vclxregion.hxx>
#include <toolkit/awt/vclxtoolkit.hxx>
+#include <toolkit/awt/vclxtabpagecontainer.hxx>
+#include <toolkit/awt/vclxtabpagemodel.hxx>
#include <toolkit/awt/xsimpleanimation.hxx>
#include <toolkit/awt/xthrobber.hxx>
+#include <toolkit/awt/animatedimagespeer.hxx>
#include <toolkit/awt/vclxtopwindow.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -115,6 +119,7 @@
#include <vcl/virdev.hxx>
#include <vcl/window.hxx>
#include <vcl/wrkwin.hxx>
+#include <vcl/throbber.hxx>
#include "toolkit/awt/vclxspinbutton.hxx"
#include <tools/debug.hxx>
@@ -313,6 +318,7 @@ static ComponentInfo __FAR_DATA aComponentInfos [] =
{ "scrollbar", WINDOW_SCROLLBAR },
{ "scrollbarbox", WINDOW_SCROLLBARBOX },
{ "simpleanimation", WINDOW_CONTROL },
+ { "animatedimages", WINDOW_CONTROL },
{ "spinbutton", WINDOW_SPINBUTTON },
{ "spinfield", WINDOW_SPINFIELD },
{ "throbber", WINDOW_CONTROL },
@@ -329,7 +335,9 @@ static ComponentInfo __FAR_DATA aComponentInfos [] =
{ "tristatebox", WINDOW_TRISTATEBOX },
{ "warningbox", WINDOW_WARNINGBOX },
{ "window", WINDOW_WINDOW },
- { "workwindow", WINDOW_WORKWINDOW }
+ { "workwindow", WINDOW_WORKWINDOW },
+ { "tabpagecontainer", WINDOW_CONTROL },
+ { "tabpagemodel", WINDOW_TABPAGE }
};
extern "C"
@@ -863,13 +871,25 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_TABCONTROL:
pNewWindow = new TabControl( pParent, nWinBits );
+ *ppNewComp = new VCLXTabPageContainer;
break;
case WINDOW_TABDIALOG:
pNewWindow = new TabDialog( pParent, nWinBits );
break;
case WINDOW_TABPAGE:
- pNewWindow = new TabPage( pParent, nWinBits );
- *ppNewComp = new VCLXTabPage;
+ /*
+ if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCase(
+ ::rtl::OUString::createFromAscii("tabpagemodel") ) )
+ {
+ pNewWindow = new TabControl( pParent, nWinBits );
+ *ppNewComp = new VCLXTabPageContainer;
+ }
+ else
+ */
+ {
+ pNewWindow = new TabPage( pParent, nWinBits );
+ *ppNewComp = new VCLXTabPage;
+ }
break;
case WINDOW_TIMEBOX:
pNewWindow = new TimeBox( pParent, nWinBits );
@@ -984,22 +1004,35 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
}
break;
case WINDOW_CONTROL:
- if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCase(
- ::rtl::OUString::createFromAscii("simpleanimation") ) )
+ if ( aServiceName.EqualsAscii( "simpleanimation" ) )
{
- nWinBits |= WB_SCALE;
- pNewWindow = new FixedImage( pParent, nWinBits );
+ pNewWindow = new Throbber( pParent, nWinBits, Throbber::IMAGES_NONE );
+ ((Throbber*)pNewWindow)->SetScaleMode( css::awt::ImageScaleMode::Anisotropic );
+ // (compatibility)
*ppNewComp = new ::toolkit::XSimpleAnimation;
}
- else if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCase(
- ::rtl::OUString::createFromAscii("throbber") ) )
+ else if ( aServiceName.EqualsAscii( "throbber" ) )
{
- nWinBits |= WB_SCALE;
- pNewWindow = new FixedImage( pParent, nWinBits );
+ pNewWindow = new Throbber( pParent, nWinBits, Throbber::IMAGES_NONE );
+ ((Throbber*)pNewWindow)->SetScaleMode( css::awt::ImageScaleMode::Anisotropic );
+ // (compatibility)
*ppNewComp = new ::toolkit::XThrobber;
}
+ else if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCase(
+ ::rtl::OUString::createFromAscii("tabpagecontainer") ) )
+ {
+ pNewWindow = new TabControl( pParent, nWinBits );
+ *ppNewComp = new VCLXTabPageContainer;
+ }
+ else if ( aServiceName.EqualsAscii( "animatedimages" ) )
+ {
+ pNewWindow = new Throbber( pParent, nWinBits );
+ *ppNewComp = new ::toolkit::AnimatedImagesPeer;
+ }
break;
- default: DBG_ERRORFILE( "UNO3!" );
+ default:
+ OSL_ENSURE( false, "VCLXToolkit::ImplCreateWindow: unknown window type!" );
+ break;
}
}
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 808f3578ef97..5d25e2f7b29b 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -65,6 +65,7 @@
#include <vcl/tabpage.hxx>
#include <vcl/button.hxx>
#include <comphelper/asyncnotification.hxx>
+#include <comphelper/flagguard.hxx>
#include <toolkit/helper/solarrelease.hxx>
#include "stylesettings.hxx"
#include <tools/urlobj.hxx>
@@ -95,32 +96,6 @@ namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior;
using ::toolkit::ReleaseSolarMutex;
//====================================================================
-//= misc helpers
-//====================================================================
-namespace
-{
- //................................................................
- //. FlagGuard
- //................................................................
- class FlagGuard
- {
- private:
- bool& m_rFlag;
-
- public:
- FlagGuard( bool& _rFlag )
- :m_rFlag( _rFlag )
- {
- m_rFlag = true;
- }
- ~FlagGuard()
- {
- m_rFlag = false;
- }
- };
-}
-
-//====================================================================
//= VCLXWindowImpl
//====================================================================
class SAL_DLLPRIVATE VCLXWindowImpl
@@ -2347,7 +2322,7 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno:
// #i40647# / 2005-01-18 / frank.schoenheit@sun.com
if ( !mpImpl->getDrawingOntoParent_ref() )
{
- FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() );
+ ::comphelper::FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() );
BOOL bWasVisible = pWindow->IsVisible();
Point aOldPos( pWindow->GetPosPixel() );
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 6c6b9dc4b2c8..fa3f840a05d6 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -37,6 +37,7 @@
#include <toolkit/helper/imagealign.hxx>
#include <toolkit/helper/accessibilityclient.hxx>
#include <toolkit/helper/fixedhyperbase.hxx>
+#include <toolkit/helper/tkresmgr.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/awt/VisualEffect.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -62,6 +63,7 @@
#include <vcl/scrbar.hxx>
#include <vcl/svapp.hxx>
#include <vcl/tabpage.hxx>
+#include <vcl/tabctrl.hxx>
#include <tools/diagnose_ex.h>
#include <boost/bind.hpp>
@@ -219,7 +221,7 @@ void VCLXGraphicControl::ImplSetNewImage()
{
OSL_PRECOND( GetWindow(), "VCLXGraphicControl::ImplSetNewImage: window is required to be not-NULL!" );
Button* pButton = static_cast< Button* >( GetWindow() );
- pButton->SetModeBitmap( GetBitmap() );
+ pButton->SetModeImage( GetImage() );
}
void VCLXGraphicControl::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, short Flags ) throw(::com::sun::star::uno::RuntimeException)
@@ -660,14 +662,14 @@ void VCLXImageControl::ImplSetNewImage()
{
OSL_PRECOND( GetWindow(), "VCLXImageControl::ImplSetNewImage: window is required to be not-NULL!" );
ImageControl* pControl = static_cast< ImageControl* >( GetWindow() );
- pControl->SetBitmap( GetBitmap() );
+ pControl->SetImage( GetImage() );
}
::com::sun::star::awt::Size VCLXImageControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- Size aSz = GetBitmap().GetSizePixel();
+ Size aSz = GetImage().GetSizePixel();
aSz = ImplCalcWindowSize( aSz );
return AWTSize(aSz);
@@ -2068,34 +2070,32 @@ void VCLXListBox::ImplCallItemListeners()
maItemListeners.itemStateChanged( aEvent );
}
}
-
namespace
{
- Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL )
- {
- if ( !i_rImageURL.getLength() )
- return Image();
+ Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL )
+ {
+ if ( !i_rImageURL.getLength() )
+ return Image();
try
{
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- Reference< XGraphicProvider > xProvider;
- if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
- {
- ::comphelper::NamedValueCollection aMediaProperties;
- aMediaProperties.put( "URL", i_rImageURL );
- Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XGraphicProvider > xProvider;
+ if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ {
+ ::comphelper::NamedValueCollection aMediaProperties;
+ aMediaProperties.put( "URL", i_rImageURL );
+ Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
return Image( xGraphic );
- }
- }
- catch( const uno::Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return Image();
- }
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return Image();
+ }
}
-
void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
@@ -2107,7 +2107,7 @@ void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) thr
"VCLXListBox::listItemInserted: illegal (inconsistent) item position!" );
pListBox->InsertEntry(
i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
- i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
+ i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
i_rEvent.ItemPosition );
}
@@ -2137,7 +2137,7 @@ void SAL_CALL VCLXListBox::listItemModified( const ItemListEvent& i_rEvent ) thr
// VCL's ListBox does not support changing an entry's text or image, so remove and re-insert
const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pListBox->GetEntry( i_rEvent.ItemPosition ) );
- const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition ) );
+ const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition ) );
pListBox->RemoveEntry( i_rEvent.ItemPosition );
pListBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
@@ -2554,6 +2554,15 @@ throw(::com::sun::star::uno::RuntimeException)
}
}
break;
+ case BASEPROPERTY_TITLE:
+ {
+ ::rtl::OUString sTitle;
+ if ( Value >>= sTitle )
+ {
+ pTabPage->SetText(sTitle);
+ }
+ }
+ break;
default:
{
diff --git a/toolkit/source/awt/xsimpleanimation.cxx b/toolkit/source/awt/xsimpleanimation.cxx
index c7ccbde118f4..75701cb94b46 100644
--- a/toolkit/source/awt/xsimpleanimation.cxx
+++ b/toolkit/source/awt/xsimpleanimation.cxx
@@ -29,8 +29,8 @@
#include "precompiled_toolkit.hxx"
#include "toolkit/awt/xsimpleanimation.hxx"
#include "toolkit/helper/property.hxx"
-#include "toolkit/helper/throbberimpl.hxx"
#include <tools/debug.hxx>
+#include <vcl/throbber.hxx>
//........................................................................
namespace toolkit
@@ -48,54 +48,40 @@ namespace toolkit
XSimpleAnimation::XSimpleAnimation()
{
DBG_CTOR( XSimpleAnimation, NULL );
- mbRepeat = sal_True;
- mnStepTime = 100;
- mpThrobber = new Throbber_Impl( this, mnStepTime, mbRepeat );
}
//--------------------------------------------------------------------
XSimpleAnimation::~XSimpleAnimation()
{
DBG_DTOR( XSimpleAnimation, NULL );
- delete mpThrobber;
}
//--------------------------------------------------------------------
- IMPLEMENT_FORWARD_XINTERFACE2( XSimpleAnimation, VCLXWindow, XSimpleAnimation_Base )
-
- //--------------------------------------------------------------------
- IMPLEMENT_FORWARD_XTYPEPROVIDER2( XSimpleAnimation, VCLXWindow, XSimpleAnimation_Base )
-
- //--------------------------------------------------------------------
void SAL_CALL XSimpleAnimation::start() throw ( uno::RuntimeException )
{
- mpThrobber->start();
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->start();
}
//--------------------------------------------------------------------
void SAL_CALL XSimpleAnimation::stop() throw ( uno::RuntimeException )
{
- mpThrobber->stop();
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->stop();
}
//--------------------------------------------------------------------
void SAL_CALL XSimpleAnimation::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& rImageList )
throw ( uno::RuntimeException )
{
- mpThrobber->setImageList( rImageList );
- }
-
- //--------------------------------------------------------------------
- void XSimpleAnimation::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
- {
- // TODO: XSimpleAnimation::ProcessWindowEvent
- //::vos::OClearableGuard aGuard( GetMutex() );
- //Reference< XSimpleAnimation > xKeepAlive( this );
- //SpinButton* pSpinButton = static_cast< SpinButton* >( GetWindow() );
- //if ( !pSpinButton )
- // return;
-
- VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->setImageList( rImageList );
}
//--------------------------------------------------------------------
@@ -104,33 +90,31 @@ namespace toolkit
{
::vos::OGuard aGuard( GetMutex() );
- if ( GetWindow() )
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber == NULL )
{
- sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
- switch ( nPropertyId )
- {
- case BASEPROPERTY_STEP_TIME: {
- sal_Int32 nStepTime( 0 );
- if ( Value >>= nStepTime )
- {
- mnStepTime = nStepTime;
- mpThrobber->setStepTime( mnStepTime );
- }
-
- break;
- }
- case BASEPROPERTY_REPEAT: {
- sal_Bool bRepeat( sal_True );
- if ( Value >>= bRepeat )
- {
- mbRepeat = bRepeat;
- mpThrobber->setRepeat( mbRepeat );
- }
- break;
- }
- default:
- VCLXWindow::setProperty( PropertyName, Value );
+ VCLXWindow::setProperty( PropertyName, Value );
+ return;
+ }
+
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ case BASEPROPERTY_STEP_TIME: {
+ sal_Int32 nStepTime( 0 );
+ if ( Value >>= nStepTime )
+ pThrobber->setStepTime( nStepTime );
+
+ break;
}
+ case BASEPROPERTY_REPEAT: {
+ sal_Bool bRepeat( sal_True );
+ if ( Value >>= bRepeat )
+ pThrobber->setRepeat( bRepeat );
+ break;
+ }
+ default:
+ VCLXWindow::setProperty( PropertyName, Value );
}
}
@@ -140,22 +124,22 @@ namespace toolkit
{
::vos::OGuard aGuard( GetMutex() );
- uno::Any aReturn;
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber == NULL )
+ return VCLXWindow::getProperty( PropertyName );
- if ( GetWindow() )
+ uno::Any aReturn;
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
{
- sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
- switch ( nPropertyId )
- {
- case BASEPROPERTY_STEP_TIME:
- aReturn <<= mnStepTime;
- break;
- case BASEPROPERTY_REPEAT:
- aReturn <<= mbRepeat;
- break;
- default:
- aReturn = VCLXWindow::getProperty( PropertyName );
- }
+ case BASEPROPERTY_STEP_TIME:
+ aReturn <<= pThrobber->getStepTime();
+ break;
+ case BASEPROPERTY_REPEAT:
+ aReturn <<= pThrobber->getRepeat();
+ break;
+ default:
+ aReturn = VCLXWindow::getProperty( PropertyName );
}
return aReturn;
}
diff --git a/toolkit/source/awt/xthrobber.cxx b/toolkit/source/awt/xthrobber.cxx
index 439fb49c1cbe..3b9b361202e9 100644
--- a/toolkit/source/awt/xthrobber.cxx
+++ b/toolkit/source/awt/xthrobber.cxx
@@ -30,7 +30,6 @@
#include "toolkit/awt/xthrobber.hxx"
#include "toolkit/helper/property.hxx"
#include <toolkit/helper/tkresmgr.hxx>
-#include <toolkit/helper/throbberimpl.hxx>
#ifndef _TOOLKIT_AWT_XTHROBBER_HRC_
#include "xthrobber.hrc"
@@ -38,6 +37,7 @@
#include <tools/debug.hxx>
#include <vcl/fixed.hxx>
#include <vcl/timer.hxx>
+#include <vcl/throbber.hxx>
//........................................................................
namespace toolkit
@@ -55,82 +55,37 @@ namespace toolkit
XThrobber::XThrobber()
{
DBG_CTOR( XThrobber, NULL );
-
- mpThrobber = new Throbber_Impl( this, 100, sal_True );
-
- InitImageList();
}
//--------------------------------------------------------------------
XThrobber::~XThrobber()
{
DBG_DTOR( XThrobber, NULL );
- delete mpThrobber;
}
//--------------------------------------------------------------------
- IMPLEMENT_FORWARD_XINTERFACE2( XThrobber, VCLXWindow, XThrobber_Base )
-
- //--------------------------------------------------------------------
- IMPLEMENT_FORWARD_XTYPEPROVIDER2( XThrobber, VCLXWindow, XThrobber_Base )
-
- //--------------------------------------------------------------------
void SAL_CALL XThrobber::start() throw ( uno::RuntimeException )
{
- mpThrobber->start();
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->start();
}
//--------------------------------------------------------------------
void SAL_CALL XThrobber::stop() throw ( uno::RuntimeException )
{
- mpThrobber->stop();
- }
-
- //--------------------------------------------------------------------
- void XThrobber::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
- {
- static bool bInit = false;
- if ( !bInit )
- {
- // Images won't be shown if set too early
- mpThrobber->initImage();
- bInit = true;
- }
- // TODO: XSimpleAnimation::ProcessWindowEvent
- //::vos::OClearableGuard aGuard( GetMutex() );
- //Reference< XSimpleAnimation > xKeepAlive( this );
- //SpinButton* pSpinButton = static_cast< SpinButton* >( GetWindow() );
- //if ( !pSpinButton )
- // return;
-
- VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL XThrobber::setProperty( const ::rtl::OUString& PropertyName, const uno::Any& Value )
- throw( uno::RuntimeException )
- {
::vos::OGuard aGuard( GetMutex() );
-
- if ( GetWindow() )
- {
- VCLXWindow::setProperty( PropertyName, Value );
- }
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->stop();
}
//--------------------------------------------------------------------
- uno::Any SAL_CALL XThrobber::getProperty( const ::rtl::OUString& PropertyName )
- throw( uno::RuntimeException )
+ void XThrobber::SetWindow( Window* pWindow )
{
- ::vos::OGuard aGuard( GetMutex() );
-
- uno::Any aReturn;
-
- if ( GetWindow() )
- {
- aReturn = VCLXWindow::getProperty( PropertyName );
- }
- return aReturn;
+ XThrobber_Base::SetWindow( pWindow );
+ InitImageList();
}
//--------------------------------------------------------------------
@@ -138,10 +93,15 @@ namespace toolkit
throw( uno::RuntimeException )
{
::vos::OGuard aGuard( GetMutex() );
+
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber == NULL)
+ return;
+
uno::Sequence< uno::Reference< graphic::XGraphic > > aImageList(12);
sal_uInt16 nIconIdStart = RID_TK_ICON_THROBBER_START;
- if ( mpThrobber->isHCMode() )
+ if ( pThrobber->GetSettings().GetStyleSettings().GetHighContrastMode() )
nIconIdStart = RID_TK_HC_ICON_THROBBER_START;
for ( sal_uInt16 i=0; i<12; i++ )
@@ -150,7 +110,7 @@ namespace toolkit
aImageList[i] = aImage.GetXGraphic();
}
- mpThrobber->setImageList( aImageList );
+ pThrobber->setImageList( aImageList );
}
//........................................................................
diff --git a/toolkit/source/controls/animatedimages.cxx b/toolkit/source/controls/animatedimages.cxx
new file mode 100755
index 000000000000..03cb2f26f324
--- /dev/null
+++ b/toolkit/source/controls/animatedimages.cxx
@@ -0,0 +1,491 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_toolkit.hxx"
+
+#include "toolkit/controls/animatedimages.hxx"
+#include "toolkit/helper/servicenames.hxx"
+#include "toolkit/helper/property.hxx"
+#include "toolkit/helper/unopropertyarrayhelper.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::container::ContainerEvent;
+ using ::com::sun::star::container::XContainerListener;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::lang::IndexOutOfBoundsException;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::awt::XControlModel;
+ using ::com::sun::star::awt::XAnimatedImages;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::awt::XWindowPeer;
+ using ::com::sun::star::util::XModifyListener;
+ using ::com::sun::star::awt::XToolkit;
+ /** === end UNO using === **/
+ namespace VisualEffect = ::com::sun::star::awt::VisualEffect;
+ namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
+
+ //==================================================================================================================
+ //= AnimatedImagesControl
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ AnimatedImagesControl::AnimatedImagesControl()
+ :AnimatedImagesControl_Base()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString AnimatedImagesControl::GetComponentServiceName()
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AnimatedImages" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::startAnimation( ) throw (RuntimeException)
+ {
+ Reference< XAnimation > xAnimation( getPeer(), UNO_QUERY );
+ if ( xAnimation.is() )
+ xAnimation->startAnimation();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::stopAnimation( ) throw (RuntimeException)
+ {
+ Reference< XAnimation > xAnimation( getPeer(), UNO_QUERY );
+ if ( xAnimation.is() )
+ xAnimation->stopAnimation();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL AnimatedImagesControl::isAnimationRunning( ) throw (RuntimeException)
+ {
+ Reference< XAnimation > xAnimation( getPeer(), UNO_QUERY );
+ if ( xAnimation.is() )
+ return xAnimation->isAnimationRunning();
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AnimatedImagesControl::getImplementationName( ) throw(RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.toolkit.AnimatedImagesControl" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL AnimatedImagesControl::getSupportedServiceNames() throw(RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServices( AnimatedImagesControl_Base::getSupportedServiceNames() );
+ aServices.realloc( aServices.getLength() + 1 );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControl );
+ return aServices;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ void lcl_updatePeer( Reference< XWindowPeer > const& i_peer, Reference< XControlModel > const& i_model )
+ {
+ const Reference< XModifyListener > xPeerModify( i_peer, UNO_QUERY );
+ if ( xPeerModify.is() )
+ {
+ EventObject aEvent;
+ aEvent.Source = i_model;
+ xPeerModify->modified( aEvent );
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL AnimatedImagesControl::setModel( const Reference< XControlModel >& i_rModel ) throw ( RuntimeException )
+ {
+ const Reference< XAnimatedImages > xOldContainer( getModel(), UNO_QUERY );
+ const Reference< XAnimatedImages > xNewContainer( i_rModel, UNO_QUERY );
+
+ if ( !AnimatedImagesControl_Base::setModel( i_rModel ) )
+ return sal_False;
+
+ if ( xOldContainer.is() )
+ xOldContainer->removeContainerListener( this );
+
+ if ( xNewContainer.is() )
+ xNewContainer->addContainerListener( this );
+
+ lcl_updatePeer( getPeer(), getModel() );
+
+ return sal_True;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::createPeer( const Reference< XToolkit >& i_toolkit, const Reference< XWindowPeer >& i_parentPeer ) throw(RuntimeException)
+ {
+ AnimatedImagesControl_Base::createPeer( i_toolkit, i_parentPeer );
+
+ lcl_updatePeer( getPeer(), getModel() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ const Reference< XContainerListener > xPeerListener( getPeer(), UNO_QUERY );
+ if ( xPeerListener.is() )
+ xPeerListener->elementInserted( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ const Reference< XContainerListener > xPeerListener( getPeer(), UNO_QUERY );
+ if ( xPeerListener.is() )
+ xPeerListener->elementRemoved( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ const Reference< XContainerListener > xPeerListener( getPeer(), UNO_QUERY );
+ if ( xPeerListener.is() )
+ xPeerListener->elementReplaced( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::disposing( const EventObject& i_event ) throw (RuntimeException)
+ {
+ UnoControlBase::disposing( i_event );
+ }
+
+ //==================================================================================================================
+ //= AnimatedImagesControlModel_Data
+ //==================================================================================================================
+ struct AnimatedImagesControlModel_Data
+ {
+ ::std::vector< Sequence< ::rtl::OUString > > aImageSets;
+ };
+
+ namespace
+ {
+ void lcl_checkIndex( const AnimatedImagesControlModel_Data& i_data, const sal_Int32 i_index, const Reference< XInterface >& i_context,
+ const bool i_forInsert = false )
+ {
+ if ( ( i_index < 0 ) || ( size_t( i_index ) > i_data.aImageSets.size() + ( i_forInsert ? 1 : 0 ) ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), i_context );
+ }
+
+ void lcl_notify( ::osl::ClearableMutexGuard& i_guard, ::cppu::OBroadcastHelper& i_broadcaseHelper,
+ void ( SAL_CALL XContainerListener::*i_notificationMethod )( const ContainerEvent& ),
+ const sal_Int32 i_accessor, const Sequence< ::rtl::OUString >& i_imageURLs, const Reference< XInterface >& i_context )
+ {
+ ::cppu::OInterfaceContainerHelper* pContainerListeners = i_broadcaseHelper.getContainer( XContainerListener::static_type() );
+ if ( pContainerListeners == NULL )
+ return;
+
+ ContainerEvent aEvent;
+ aEvent.Source = i_context;
+ aEvent.Accessor <<= i_accessor;
+ aEvent.Element <<= i_imageURLs;
+
+ i_guard.clear();
+ pContainerListeners->notifyEach( i_notificationMethod, aEvent );
+ }
+ }
+
+ //==================================================================================================================
+ //= AnimatedImagesControlModel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ AnimatedImagesControlModel::AnimatedImagesControlModel()
+ :m_pData( new AnimatedImagesControlModel_Data )
+ {
+ ImplRegisterProperty( BASEPROPERTY_AUTO_REPEAT );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_IMAGE_SCALE_MODE );
+ ImplRegisterProperty( BASEPROPERTY_STEP_TIME );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AnimatedImagesControlModel::AnimatedImagesControlModel( const AnimatedImagesControlModel& i_copySource )
+ :AnimatedImagesControlModel_Base( i_copySource )
+ ,m_pData( new AnimatedImagesControlModel_Data( *i_copySource.m_pData ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AnimatedImagesControlModel::~AnimatedImagesControlModel()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ UnoControlModel* AnimatedImagesControlModel::Clone() const
+ {
+ return new AnimatedImagesControlModel( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XPropertySetInfo > SAL_CALL AnimatedImagesControlModel::getPropertySetInfo( ) throw(RuntimeException)
+ {
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AnimatedImagesControlModel::getServiceName() throw(RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AnimatedImagesControlModel::getImplementationName( ) throw(RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( "org.openoffice.comp.toolkit.AnimatedImagesControlModel" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL AnimatedImagesControlModel::getSupportedServiceNames() throw(RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServiceNames(2);
+ aServiceNames[0] = ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
+ aServiceNames[1] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.UnoControlModel" );
+ return aServiceNames;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 i_handle, const Any& i_value ) throw (Exception)
+ {
+ switch ( i_handle )
+ {
+ case BASEPROPERTY_IMAGE_SCALE_MODE:
+ {
+ sal_Int16 nImageScaleMode( ImageScaleMode::Anisotropic );
+ OSL_VERIFY( i_value >>= nImageScaleMode ); // convertFastPropertyValue ensures that this has the proper type
+ if ( ( nImageScaleMode != ImageScaleMode::None )
+ && ( nImageScaleMode != ImageScaleMode::Isotropic )
+ && ( nImageScaleMode != ImageScaleMode::Anisotropic )
+ )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+ }
+ break;
+ }
+
+ AnimatedImagesControlModel_Base::setFastPropertyValue_NoBroadcast( i_handle, i_value );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any AnimatedImagesControlModel::ImplGetDefaultValue( sal_uInt16 i_propertyId ) const
+ {
+ switch ( i_propertyId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return makeAny( ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControl ) );
+
+ case BASEPROPERTY_BORDER:
+ return makeAny( VisualEffect::NONE );
+
+ case BASEPROPERTY_STEP_TIME:
+ return makeAny( (sal_Int32) 100 );
+
+ case BASEPROPERTY_AUTO_REPEAT:
+ return makeAny( (sal_Bool)sal_True );
+
+ case BASEPROPERTY_IMAGE_SCALE_MODE:
+ return makeAny( ImageScaleMode::None );
+
+ default:
+ return UnoControlModel::ImplGetDefaultValue( i_propertyId );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& SAL_CALL AnimatedImagesControlModel::getInfoHelper()
+ {
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence< sal_Int32 > aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL AnimatedImagesControlModel::getStepTime() throw (RuntimeException)
+ {
+ sal_Int32 nStepTime( 100 );
+ OSL_VERIFY( getPropertyValue( GetPropertyName( BASEPROPERTY_STEP_TIME ) ) >>= nStepTime );
+ return nStepTime;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::setStepTime( ::sal_Int32 i_stepTime ) throw (RuntimeException)
+ {
+ setPropertyValue( GetPropertyName( BASEPROPERTY_STEP_TIME ), makeAny( i_stepTime ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL AnimatedImagesControlModel::getAutoRepeat() throw (RuntimeException)
+ {
+ sal_Bool bAutoRepeat( sal_True );
+ OSL_VERIFY( getPropertyValue( GetPropertyName( BASEPROPERTY_AUTO_REPEAT ) ) >>= bAutoRepeat );
+ return bAutoRepeat;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::setAutoRepeat( ::sal_Bool i_autoRepeat ) throw (RuntimeException)
+ {
+ setPropertyValue( GetPropertyName( BASEPROPERTY_AUTO_REPEAT ), makeAny( i_autoRepeat ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int16 SAL_CALL AnimatedImagesControlModel::getScaleMode() throw (RuntimeException)
+ {
+ sal_Int16 nImageScaleMode( ImageScaleMode::Anisotropic );
+ OSL_VERIFY( getPropertyValue( GetPropertyName( BASEPROPERTY_IMAGE_SCALE_MODE ) ) >>= nImageScaleMode );
+ return nImageScaleMode;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::setScaleMode( ::sal_Int16 i_scaleMode ) throw (IllegalArgumentException, RuntimeException)
+ {
+ setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGE_SCALE_MODE ), makeAny( i_scaleMode ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL AnimatedImagesControlModel::getImageSetCount( ) throw (RuntimeException)
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
+ throw DisposedException();
+
+ return m_pData->aImageSets.size();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL AnimatedImagesControlModel::getImageSet( ::sal_Int32 i_index ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
+ throw DisposedException();
+
+ lcl_checkIndex( *m_pData, i_index, *this );
+
+ return m_pData->aImageSets[ i_index ];
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::insertImageSet( ::sal_Int32 i_index, const Sequence< ::rtl::OUString >& i_imageURLs ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // sanity checks
+ if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
+ throw DisposedException();
+
+ lcl_checkIndex( *m_pData, i_index, *this, true );
+
+ // actaul insertion
+ m_pData->aImageSets.insert( m_pData->aImageSets.begin() + i_index, i_imageURLs );
+
+ // listener notification
+ lcl_notify( aGuard, BrdcstHelper, &XContainerListener::elementInserted, i_index, i_imageURLs, *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::replaceImageSet( ::sal_Int32 i_index, const Sequence< ::rtl::OUString >& i_imageURLs ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // sanity checks
+ if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
+ throw DisposedException();
+
+ lcl_checkIndex( *m_pData, i_index, *this );
+
+ // actaul insertion
+ m_pData->aImageSets[ i_index ] = i_imageURLs;
+
+ // listener notification
+ lcl_notify( aGuard, BrdcstHelper, &XContainerListener::elementReplaced, i_index, i_imageURLs, *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::removeImageSet( ::sal_Int32 i_index ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // sanity checks
+ if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
+ throw DisposedException();
+
+ lcl_checkIndex( *m_pData, i_index, *this );
+
+ // actual removal
+ ::std::vector< Sequence< ::rtl::OUString > >::iterator removalPos = m_pData->aImageSets.begin() + i_index;
+ Sequence< ::rtl::OUString > aRemovedElement( *removalPos );
+ m_pData->aImageSets.erase( removalPos );
+
+ // listener notification
+ lcl_notify( aGuard, BrdcstHelper, &XContainerListener::elementRemoved, i_index, aRemovedElement, *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::addContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException)
+ {
+ BrdcstHelper.addListener( XContainerListener::static_type(), i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::removeContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException)
+ {
+ BrdcstHelper.removeListener( XContainerListener::static_type(), i_listener );
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
new file mode 100644
index 000000000000..58ca81f74541
--- /dev/null
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -0,0 +1,1811 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/controls/controlmodelcontainerbase.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/wall.hxx>
+#include <vos/mutex.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+#include <toolkit/controls/unocontrols.hxx>
+#include "toolkit/controls/formattedcontrol.hxx"
+#include "toolkit/controls/roadmapcontrol.hxx"
+#ifndef TOOLKIT_INC_TOOLKIT_CONTROLS_TKSCROLLBAR_HXX
+#include "toolkit/controls/tkscrollbar.hxx"
+#endif
+#include <toolkit/controls/stdtabcontroller.hxx>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <tools/list.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <comphelper/types.hxx>
+
+#include <comphelper/componentcontext.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/tkresmgr.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/image.hxx>
+
+#include "tree/treecontrol.hxx"
+#include "grid/gridcontrol.hxx"
+#include <toolkit/controls/tabpagecontainer.hxx>
+
+#include <map>
+#include <algorithm>
+#include <functional>
+#include "tools/urlobj.hxx"
+#include "osl/file.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace toolkit;
+
+#define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ))
+
+//HELPER
+::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
+
+struct LanguageDependentProp
+{
+ const char* pPropName;
+ sal_Int32 nPropNameLength;
+};
+
+// ----------------------------------------------------------------------------
+namespace
+{
+ static const Sequence< ::rtl::OUString >& lcl_getLanguageDependentProperties()
+ {
+ static Sequence< ::rtl::OUString > s_aLanguageDependentProperties;
+ if ( s_aLanguageDependentProperties.getLength() == 0 )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( s_aLanguageDependentProperties.getLength() == 0 )
+ {
+ s_aLanguageDependentProperties.realloc( 2 );
+ s_aLanguageDependentProperties[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) );
+ s_aLanguageDependentProperties[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
+ // note: properties must be sorted
+ }
+ }
+ return s_aLanguageDependentProperties;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// functor for disposing a control model
+struct DisposeControlModel : public ::std::unary_function< Reference< XControlModel >, void >
+{
+ void operator()( Reference< XControlModel >& _rxModel )
+ {
+ try
+ {
+ ::comphelper::disposeComponent( _rxModel );
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "DisposeControlModel::(): caught an exception while disposing a component!" );
+ }
+ }
+};
+
+// ----------------------------------------------------------------------------
+// functor for searching control model by name
+struct FindControlModel : public ::std::unary_function< ControlModelContainerBase::UnoControlModelHolder, bool >
+{
+private:
+ const ::rtl::OUString& m_rName;
+
+public:
+ FindControlModel( const ::rtl::OUString& _rName ) : m_rName( _rName ) { }
+
+ bool operator()( const ControlModelContainerBase::UnoControlModelHolder& _rCompare )
+ {
+ return ( _rCompare.second == m_rName ) ? true : false;
+ }
+};
+
+// ----------------------------------------------------------------------------
+// functor for cloning a control model, and insertion into a target list
+struct CloneControlModel : public ::std::unary_function< ControlModelContainerBase::UnoControlModelHolder, void >
+{
+private:
+ ControlModelContainerBase::UnoControlModelHolderList& m_rTargetList;
+
+public:
+ CloneControlModel( ControlModelContainerBase::UnoControlModelHolderList& _rTargetList )
+ :m_rTargetList( _rTargetList )
+ {
+ }
+
+ void operator()( const ControlModelContainerBase::UnoControlModelHolder& _rSource )
+ {
+ // clone the source object
+ Reference< XCloneable > xCloneSource( _rSource.first, UNO_QUERY );
+ Reference< XControlModel > xClone( xCloneSource->createClone(), UNO_QUERY );
+ // add to target list
+ m_rTargetList.push_back( ControlModelContainerBase::UnoControlModelHolder( xClone, _rSource.second ) );
+ }
+};
+
+// ----------------------------------------------------------------------------
+// functor for comparing a XControlModel with a given reference
+struct CompareControlModel : public ::std::unary_function< ControlModelContainerBase::UnoControlModelHolder, bool >
+{
+private:
+ Reference< XControlModel > m_xReference;
+public:
+ CompareControlModel( const Reference< XControlModel >& _rxReference ) : m_xReference( _rxReference ) { }
+
+ bool operator()( const ControlModelContainerBase::UnoControlModelHolder& _rCompare )
+ {
+ return ( _rCompare.first.get() == m_xReference.get() ) ? true : false;
+ }
+};
+
+// ----------------------------------------------------------------------------
+static void lcl_throwIllegalArgumentException( )
+{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
+ throw IllegalArgumentException();
+}
+
+// ----------------------------------------------------------------------------
+static void lcl_throwNoSuchElementException( )
+{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
+ throw NoSuchElementException();
+}
+
+// ----------------------------------------------------------------------------
+static void lcl_throwElementExistException( )
+{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
+ throw ElementExistException();
+}
+
+// ----------------------------------------------------------------------------
+static const ::rtl::OUString& getTabIndexPropertyName( )
+{
+ static const ::rtl::OUString s_sTabIndexProperty( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) );
+ return s_sTabIndexProperty;
+}
+
+// ----------------------------------------------------------------------------
+static const ::rtl::OUString& getStepPropertyName( )
+{
+ static const ::rtl::OUString s_sStepProperty( RTL_CONSTASCII_USTRINGPARAM( "Step" ) );
+ return s_sStepProperty;
+}
+
+// ----------------------------------------------------
+// class ControlModelContainerBase
+// ----------------------------------------------------
+ControlModelContainerBase::ControlModelContainerBase()
+ :maContainerListeners( *this )
+ ,maChangeListeners ( GetMutex() )
+ ,mbGroupsUpToDate( sal_False )
+{
+}
+
+ControlModelContainerBase::ControlModelContainerBase( const ControlModelContainerBase& rModel )
+ : ControlModelContainer_IBase( rModel )
+ , maContainerListeners( *this )
+ , maChangeListeners ( GetMutex() )
+ , mbGroupsUpToDate( sal_False )
+{
+}
+
+ControlModelContainerBase::~ControlModelContainerBase()
+{
+ maModels.clear();
+ mbGroupsUpToDate = sal_False;
+}
+
+Any ControlModelContainerBase::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ Any aAny;
+
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialog );
+ break;
+ default:
+ aAny = UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+
+ return aAny;
+}
+
+::cppu::IPropertyArrayHelper& ControlModelContainerBase::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+void SAL_CALL ControlModelContainerBase::dispose( ) throw(RuntimeException)
+{
+ // ====================================================================
+ // tell our listeners
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ EventObject aDisposeEvent;
+ aDisposeEvent.Source = static_cast< XAggregation* >( static_cast< ::cppu::OWeakAggObject* >( this ) );
+
+ maContainerListeners.disposeAndClear( aDisposeEvent );
+ maChangeListeners.disposeAndClear( aDisposeEvent );
+ }
+
+ // ====================================================================
+ // call the base class
+ UnoControlModel::dispose();
+
+ // ====================================================================
+ // dispose our child models
+ // for this, collect the models (we collect them from maModels, and this is modified when disposing children)
+ ::std::vector< Reference< XControlModel > > aChildModels( maModels.size() );
+
+ ::std::transform(
+ maModels.begin(), maModels.end(), // source range
+ aChildModels.begin(), // target location
+ ::std::select1st< UnoControlModelHolder >( ) // operation to apply -> select the XControlModel part
+ );
+
+ // now dispose
+ ::std::for_each( aChildModels.begin(), aChildModels.end(), DisposeControlModel() );
+ aChildModels.clear();
+
+ mbGroupsUpToDate = sal_False;
+}
+
+// XMultiPropertySet
+Reference< XPropertySetInfo > ControlModelContainerBase::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+UnoControlModel* ControlModelContainerBase::Clone() const
+{
+ // clone the container itself
+ ControlModelContainerBase* pClone = new ControlModelContainerBase( *this );
+
+ // clone all children
+ ::std::for_each(
+ maModels.begin(), maModels.end(),
+ CloneControlModel( pClone->maModels )
+ );
+
+ return pClone;
+}
+
+ControlModelContainerBase::UnoControlModelHolderList::iterator ControlModelContainerBase::ImplFindElement( const ::rtl::OUString& rName )
+{
+ return ::std::find_if( maModels.begin(), maModels.end(), FindControlModel( rName ) );
+}
+
+// ::XMultiServiceFactory
+Reference< XInterface > ControlModelContainerBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(Exception, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ OGeometryControlModel_Base* pNewModel = NULL;
+
+ if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlEditModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlEditModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFormattedFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFormattedFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFileControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFileControlModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlButtonModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlButtonModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlImageControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlImageControlModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRadioButtonModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlRadioButtonModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCheckBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlCheckBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedHyperlinkModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedHyperlinkModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedTextModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedTextModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlGroupBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlGroupBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlListBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlListBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlComboBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlComboBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlDateFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlDateFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlTimeFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlTimeFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlNumericFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlNumericFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCurrencyFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlCurrencyFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlPatternFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlPatternFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlProgressBarModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlProgressBarModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlScrollBarModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlScrollBarModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedLineModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedLineModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRoadmapModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlRoadmapModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_TreeControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoTreeModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoGridModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlTabPageContainerModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlTabPageContainerModel >;
+
+ if ( !pNewModel )
+ {
+ Reference< XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() );
+ if ( xORB.is() )
+ {
+ Reference< XInterface > xObject = xORB->createInstance( aServiceSpecifier );
+ Reference< XServiceInfo > xSI( xObject, UNO_QUERY );
+ Reference< XCloneable > xCloneAccess( xSI, UNO_QUERY );
+ Reference< XAggregation > xAgg( xCloneAccess, UNO_QUERY );
+ if ( xAgg.is() )
+ {
+ if ( xSI->supportsService( ::rtl::OUString::createFromAscii( "com.sun.star.awt.UnoControlModel" ) ) )
+ {
+ // release 3 of the 4 references we have to the object
+ xAgg.clear();
+ xSI.clear();
+ xObject.clear();
+
+ pNewModel = new OCommonGeometryControlModel( xCloneAccess, aServiceSpecifier );
+ }
+ }
+ }
+ }
+
+ Reference< XInterface > xNewModel = (::cppu::OWeakObject*)pNewModel;
+ return xNewModel;
+}
+
+Reference< XInterface > ControlModelContainerBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& /* Arguments */ ) throw(Exception, RuntimeException)
+{
+ return createInstance( ServiceSpecifier );
+}
+
+Sequence< ::rtl::OUString > ControlModelContainerBase::getAvailableServiceNames() throw(RuntimeException)
+{
+ static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
+ if ( !pNamesSeq )
+ {
+ pNamesSeq = new Sequence< ::rtl::OUString >( 23 );
+ ::rtl::OUString* pNames = pNamesSeq->getArray();
+ pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel );
+ pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel );
+ pNames[2] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel );
+ pNames[3] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel );
+ pNames[4] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel );
+ pNames[5] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel );
+ pNames[6] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel );
+ pNames[7] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel );
+ pNames[8] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel );
+ pNames[9] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel );
+ pNames[10] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel );
+ pNames[11] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel );
+ pNames[12] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel );
+ pNames[13] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel );
+ pNames[14] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel );
+ pNames[15] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel );
+ pNames[16] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlProgressBarModel );
+ pNames[17] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlScrollBarModel );
+ pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel );
+ pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel );
+ pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel );
+ pNames[21] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
+ pNames[22] = ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageContainerModel );
+
+ }
+ return *pNamesSeq;
+}
+
+// XContainer
+void ControlModelContainerBase::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.addInterface( l );
+}
+
+void ControlModelContainerBase::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.removeInterface( l );
+}
+
+// XElementAcces
+Type ControlModelContainerBase::getElementType() throw(RuntimeException)
+{
+ Type aType = getCppuType( ( Reference< XControlModel>* ) NULL );
+ return aType;
+}
+
+sal_Bool ControlModelContainerBase::hasElements() throw(RuntimeException)
+{
+ return !maModels.empty();
+}
+
+// XNameContainer, XNameReplace, XNameAccess
+void ControlModelContainerBase::replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xNewModel;
+ aElement >>= xNewModel;
+ if ( !xNewModel.is() )
+ lcl_throwIllegalArgumentException();
+
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() == aElementPos )
+ lcl_throwNoSuchElementException();
+
+ // stop listening at the old model
+ stopControlListening( aElementPos->first );
+ Reference< XControlModel > xReplaced( aElementPos->first );
+ // remember the new model, and start listening
+ aElementPos->first = xNewModel;
+ startControlListening( xNewModel );
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element = aElement;
+ aEvent.ReplacedElement <<= xReplaced;
+ aEvent.Accessor <<= aName;
+
+ // notify the container listener
+ maContainerListeners.elementReplaced( aEvent );
+
+ // our "tab controller model" has potentially changed -> notify this
+ implNotifyTabModelChange( aName );
+}
+
+Any ControlModelContainerBase::getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() == aElementPos )
+ lcl_throwNoSuchElementException();
+
+ return makeAny( aElementPos->first );
+}
+
+Sequence< ::rtl::OUString > ControlModelContainerBase::getElementNames() throw(RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames( maModels.size() );
+
+ ::std::transform(
+ maModels.begin(), maModels.end(), // source range
+ aNames.getArray(), // target range
+ ::std::select2nd< UnoControlModelHolder >() // operator to apply: select the second element (the name)
+ );
+
+ return aNames;
+}
+
+sal_Bool ControlModelContainerBase::hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
+{
+ return maModels.end() != ImplFindElement( aName );
+}
+
+void ControlModelContainerBase::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xM;
+ aElement >>= xM;
+
+ if ( xM.is() )
+ {
+ Reference< beans::XPropertySet > xProps( xM, UNO_QUERY );
+ if ( xProps.is() )
+ {
+
+ Reference< beans::XPropertySetInfo > xPropInfo = xProps.get()->getPropertySetInfo();
+
+ ::rtl::OUString sImageSourceProperty = GetPropertyName( BASEPROPERTY_IMAGEURL );
+ if ( xPropInfo.get()->hasPropertyByName( sImageSourceProperty ) && ImplHasProperty(BASEPROPERTY_DIALOGSOURCEURL) )
+ {
+ Any aUrl = xProps.get()->getPropertyValue( sImageSourceProperty );
+
+ ::rtl::OUString absoluteUrl =
+ getPhysicalLocation( getPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL ) ), aUrl );
+
+ aUrl <<= absoluteUrl;
+
+ xProps.get()->setPropertyValue( sImageSourceProperty , aUrl );
+ }
+ }
+ }
+
+
+
+ if ( !aName.getLength() || !xM.is() )
+ lcl_throwIllegalArgumentException();
+
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() != aElementPos )
+ lcl_throwElementExistException();
+
+ maModels.push_back( UnoControlModelHolder( xM, aName ) );
+ mbGroupsUpToDate = sal_False;
+ startControlListening( xM );
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= aElement;
+ aEvent.Accessor <<= aName;
+ maContainerListeners.elementInserted( aEvent );
+
+ // our "tab controller model" has potentially changed -> notify this
+ implNotifyTabModelChange( aName );
+}
+
+void ControlModelContainerBase::removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() == aElementPos )
+ lcl_throwNoSuchElementException();
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= aElementPos->first;
+ aEvent.Accessor <<= aName;
+ maContainerListeners.elementRemoved( aEvent );
+
+ stopControlListening( aElementPos->first );
+ Reference< XPropertySet > xPS( aElementPos->first, UNO_QUERY );
+ maModels.erase( aElementPos );
+ mbGroupsUpToDate = sal_False;
+
+ if ( xPS.is() )
+ try
+ {
+ xPS->setPropertyValue( PROPERTY_RESOURCERESOLVER, makeAny( Reference< resource::XStringResourceResolver >() ) );
+ }
+ catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
+
+ // our "tab controller model" has potentially changed -> notify this
+ implNotifyTabModelChange( aName );
+}
+
+// ----------------------------------------------------------------------------
+sal_Bool SAL_CALL ControlModelContainerBase::getGroupControl( ) throw (RuntimeException)
+{
+ return sal_True;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::setGroupControl( sal_Bool ) throw (RuntimeException)
+{
+ DBG_ERROR( "UnoControlDialogModel::setGroupControl: explicit grouping not supported" );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::setControlModels( const Sequence< Reference< XControlModel > >& _rControls ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ // set the tab indexes according to the order of models in the sequence
+ const Reference< XControlModel >* pControls = _rControls.getConstArray( );
+ const Reference< XControlModel >* pControlsEnd = _rControls.getConstArray( ) + _rControls.getLength();
+
+ sal_Int16 nTabIndex = 1;
+
+ for ( ; pControls != pControlsEnd; ++pControls )
+ {
+ // look up the control in our own structure. This is to prevent invalid arguments
+ UnoControlModelHolderList::const_iterator aPos =
+ ::std::find_if(
+ maModels.begin(), maModels.end(),
+ CompareControlModel( *pControls )
+ );
+ if ( maModels.end() != aPos )
+ {
+ // okay, this is an existent model
+ // now set the TabIndex property (if applicable)
+ Reference< XPropertySet > xProps( aPos->first, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xProps.is() )
+ xPSI = xProps->getPropertySetInfo();
+ if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
+ xProps->setPropertyValue( getTabIndexPropertyName(), makeAny( nTabIndex++ ) );
+ }
+ mbGroupsUpToDate = sal_False;
+ }
+}
+
+
+typedef ::std::multimap< sal_Int32, Reference< XControlModel >, ::std::less< sal_Int32 > > MapIndexToModel;
+
+// ----------------------------------------------------------------------------
+Sequence< Reference< XControlModel > > SAL_CALL ControlModelContainerBase::getControlModels( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ MapIndexToModel aSortedModels;
+ // will be the sorted container of all models which have a tab index property
+ ::std::vector< Reference< XControlModel > > aUnindexedModels;
+ // will be the container of all models which do not have a tab index property
+
+ UnoControlModelHolderList::const_iterator aLoop = maModels.begin();
+ for ( ; aLoop != maModels.end(); ++aLoop )
+ {
+ Reference< XControlModel > xModel( aLoop->first );
+
+ // see if the model has a TabIndex property
+ Reference< XPropertySet > xControlProps( xModel, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xControlProps.is() )
+ xPSI = xControlProps->getPropertySetInfo( );
+ DBG_ASSERT( xPSI.is(), "UnoControlDialogModel::getControlModels: invalid child model!" );
+
+ // has it?
+ if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
+ { // yes
+ sal_Int32 nTabIndex = -1;
+ xControlProps->getPropertyValue( getTabIndexPropertyName() ) >>= nTabIndex;
+
+ aSortedModels.insert( MapIndexToModel::value_type( nTabIndex, xModel ) );
+ }
+ else if ( xModel.is() )
+ // no, it hasn't, but we have to include it, anyway
+ aUnindexedModels.push_back( xModel );
+ }
+
+ // okay, here we have a container of all our models, sorted by tab index,
+ // plus a container of "unindexed" models
+ // -> merge them
+ Sequence< Reference< XControlModel > > aReturn( aUnindexedModels.size() + aSortedModels.size() );
+ ::std::transform(
+ aSortedModels.begin(), aSortedModels.end(),
+ ::std::copy( aUnindexedModels.begin(), aUnindexedModels.end(), aReturn.getArray() ),
+ ::std::select2nd< MapIndexToModel::value_type >( )
+ );
+
+ return aReturn;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::setGroup( const Sequence< Reference< XControlModel > >&, const ::rtl::OUString& ) throw (RuntimeException)
+{
+ // not supported. We have only implicit grouping:
+ // We only have a sequence of control models, and we _know_ (yes, that's a HACK relying on
+ // implementation details) that VCL does grouping according to the order of controls automatically
+ // At least VCL does this for all we're interested in: Radio buttons.
+ DBG_ERROR( "UnoControlDialogModel::setGroup: grouping not supported" );
+}
+
+////----- XInitialization -------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::initialize (const Sequence<Any>& rArguments) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nPageId = -1;
+ if ( rArguments.getLength() == 1 )
+ {
+ if ( !( rArguments[ 0 ] >>= nPageId ))
+ throw lang::IllegalArgumentException();
+ m_nTabPageId = nPageId;
+ }
+ else
+ m_nTabPageId = -1;
+}
+::sal_Int16 SAL_CALL ControlModelContainerBase::getTabPageID() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_nTabPageId;
+}
+::sal_Bool SAL_CALL ControlModelContainerBase::getEnabled() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_bEnabled;
+}
+void SAL_CALL ControlModelContainerBase::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_bEnabled = _enabled;
+}
+::rtl::OUString SAL_CALL ControlModelContainerBase::getTitle() throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference<XPropertySet> xThis(*this,UNO_QUERY);
+ ::rtl::OUString sTitle;
+ xThis->getPropertyValue(GetPropertyName(BASEPROPERTY_TITLE)) >>= sTitle;
+ return sTitle;
+ //return m_sTitle;
+}
+void SAL_CALL ControlModelContainerBase::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference<XPropertySet> xThis(*this,UNO_QUERY);
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_TITLE),makeAny(_title));
+}
+::rtl::OUString SAL_CALL ControlModelContainerBase::getImageURL() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_sImageURL;
+}
+void SAL_CALL ControlModelContainerBase::setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_sImageURL = _imageurl;
+}
+::rtl::OUString SAL_CALL ControlModelContainerBase::getTooltip() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_sTooltip;
+}
+void SAL_CALL ControlModelContainerBase::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_sTooltip = _tooltip;
+}
+
+// ----------------------------------------------------------------------------
+namespace
+{
+ enum GroupingMachineState
+ {
+ eLookingForGroup,
+ eExpandingGroup
+ };
+
+ // ........................................................................
+ static sal_Int32 lcl_getDialogStep( const Reference< XControlModel >& _rxModel )
+ {
+ sal_Int32 nStep = 0;
+ try
+ {
+ Reference< XPropertySet > xModelProps( _rxModel, UNO_QUERY );
+ xModelProps->getPropertyValue( getStepPropertyName() ) >>= nStep;
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "lcl_getDialogStep: caught an exception while determining the dialog page!" );
+ }
+ return nStep;
+ }
+}
+
+// ----------------------------------------------------------------------------
+sal_Int32 SAL_CALL ControlModelContainerBase::getGroupCount( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ implUpdateGroupStructure();
+
+ return maGroups.size();
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::getGroup( sal_Int32 _nGroup, Sequence< Reference< XControlModel > >& _rGroup, ::rtl::OUString& _rName ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ implUpdateGroupStructure();
+
+ if ( ( _nGroup < 0 ) || ( _nGroup >= (sal_Int32)maGroups.size() ) )
+ {
+ DBG_ERROR( "UnoControlDialogModel::getGroup: invalid argument and I am not allowed to throw an exception!" );
+ _rGroup.realloc( 0 );
+ _rName = ::rtl::OUString();
+ }
+ else
+ {
+ AllGroups::const_iterator aGroupPos = maGroups.begin() + _nGroup;
+ _rGroup.realloc( aGroupPos->size() );
+ // copy the models
+ ::std::copy( aGroupPos->begin(), aGroupPos->end(), _rGroup.getArray() );
+ // give the group a name
+ _rName = ::rtl::OUString::valueOf( _nGroup );
+ }
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::getGroupByName( const ::rtl::OUString& _rName, Sequence< Reference< XControlModel > >& _rGroup ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ ::rtl::OUString sDummyName;
+ getGroup( _rName.toInt32( ), _rGroup, sDummyName );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::addChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
+{
+ maChangeListeners.addInterface( _rxListener );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::removeChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
+{
+ maChangeListeners.removeInterface( _rxListener );
+}
+
+// ----------------------------------------------------------------------------
+void ControlModelContainerBase::implNotifyTabModelChange( const ::rtl::OUString& _rAccessor )
+{
+ // multiplex to our change listeners:
+ // the changes event
+ ChangesEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Base <<= aEvent.Source; // the "base of the changes root" is also ourself
+ aEvent.Changes.realloc( 1 ); // exactly one change
+ aEvent.Changes[ 0 ].Accessor <<= _rAccessor;
+
+
+ Sequence< Reference< XInterface > > aChangeListeners( maChangeListeners.getElements() );
+ const Reference< XInterface >* pListener = aChangeListeners.getConstArray();
+ const Reference< XInterface >* pListenerEnd = aChangeListeners.getConstArray() + aChangeListeners.getLength();
+ for ( ; pListener != pListenerEnd; ++pListener )
+ {
+ if ( pListener->is() )
+ static_cast< XChangesListener* >( pListener->get() )->changesOccurred( aEvent );
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+void ControlModelContainerBase::implUpdateGroupStructure()
+{
+ if ( mbGroupsUpToDate )
+ // nothing to do
+ return;
+
+ // conditions for a group:
+ // * all elements of the group are radio buttons
+ // * all elements of the group are on the same dialog page
+ // * in the overall control order (determined by the tab index), all elements are subsequent
+
+ maGroups.clear();
+
+ Sequence< Reference< XControlModel > > aControlModels = getControlModels();
+ const Reference< XControlModel >* pControlModels = aControlModels.getConstArray();
+ const Reference< XControlModel >* pControlModelsEnd = pControlModels + aControlModels.getLength();
+
+ // in extreme we have as much groups as controls
+ maGroups.reserve( aControlModels.getLength() );
+
+ GroupingMachineState eState = eLookingForGroup; // the current state of our machine
+ Reference< XServiceInfo > xModelSI; // for checking for a radion button
+ AllGroups::iterator aCurrentGroup = maGroups.end(); // the group which we're currently building
+ sal_Int32 nCurrentGroupStep = -1; // the step which all controls of the current group belong to
+ sal_Bool bIsRadioButton; // is it a radio button?
+
+#if OSL_DEBUG_LEVEL > 1
+ ::std::vector< ::rtl::OUString > aCurrentGroupLabels;
+#endif
+
+ for ( ; pControlModels != pControlModelsEnd; ++pControlModels )
+ {
+ // we'll need this in every state
+ xModelSI = xModelSI.query( *pControlModels );
+ bIsRadioButton = xModelSI.is() && xModelSI->supportsService( ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) );
+
+ switch ( eState )
+ {
+ case eLookingForGroup:
+ {
+ if ( !bIsRadioButton )
+ // this is no radio button -> still looking for the beginning of a group
+ continue;
+ // the current model is a radio button
+ // -> we found the beginning of a new group
+ // create the place for this group
+ size_t nGroups = maGroups.size();
+ maGroups.resize( nGroups + 1 );
+ aCurrentGroup = maGroups.begin() + nGroups;
+ // and add the (only, til now) member
+ aCurrentGroup->push_back( *pControlModels );
+
+ // get the step which all controls of this group now have to belong to
+ nCurrentGroupStep = lcl_getDialogStep( *pControlModels );
+ // new state: looking for further members
+ eState = eExpandingGroup;
+
+#if OSL_DEBUG_LEVEL > 1
+ Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
+ ::rtl::OUString sLabel;
+ if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
+ xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
+ aCurrentGroupLabels.push_back( sLabel );
+#endif
+ }
+ break;
+
+ case eExpandingGroup:
+ {
+ if ( !bIsRadioButton )
+ { // no radio button -> the group is done
+ aCurrentGroup = maGroups.end();
+ eState = eLookingForGroup;
+#if OSL_DEBUG_LEVEL > 1
+ aCurrentGroupLabels.clear();
+#endif
+ continue;
+ }
+
+ // it is a radio button - is it on the proper page?
+ const sal_Int32 nThisModelStep = lcl_getDialogStep( *pControlModels );
+ if ( ( nThisModelStep == nCurrentGroupStep ) // the current button is on the same dialog page
+ || ( 0 == nThisModelStep ) // the current button appears on all pages
+ )
+ {
+ // -> it belongs to the same group
+ aCurrentGroup->push_back( *pControlModels );
+ // state still is eExpandingGroup - we're looking for further elements
+ eState = eExpandingGroup;
+
+#if OSL_DEBUG_LEVEL > 1
+ Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
+ ::rtl::OUString sLabel;
+ if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
+ xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
+ aCurrentGroupLabels.push_back( sLabel );
+#endif
+ continue;
+ }
+
+ // it's a radio button, but on a different page
+ // -> we open a new group for it
+
+ // close the old group
+ aCurrentGroup = maGroups.end();
+#if OSL_DEBUG_LEVEL > 1
+ aCurrentGroupLabels.clear();
+#endif
+
+ // open a new group
+ size_t nGroups = maGroups.size();
+ maGroups.resize( nGroups + 1 );
+ aCurrentGroup = maGroups.begin() + nGroups;
+ // and add the (only, til now) member
+ aCurrentGroup->push_back( *pControlModels );
+
+ nCurrentGroupStep = nThisModelStep;
+
+ // state is the same: we still are looking for further elements of the current group
+ eState = eExpandingGroup;
+#if OSL_DEBUG_LEVEL > 1
+ Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
+ ::rtl::OUString sLabel;
+ if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
+ xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
+ aCurrentGroupLabels.push_back( sLabel );
+#endif
+ }
+ break;
+ }
+ }
+
+ mbGroupsUpToDate = sal_True;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::propertyChange( const PropertyChangeEvent& _rEvent ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ DBG_ASSERT( 0 == _rEvent.PropertyName.compareToAscii( "TabIndex" ),
+ "UnoControlDialogModel::propertyChange: not listening for this property!" );
+
+ // the accessor for the changed element
+ ::rtl::OUString sAccessor;
+ UnoControlModelHolderList::const_iterator aPos =
+ ::std::find_if(
+ maModels.begin(), maModels.end(),
+ CompareControlModel( Reference< XControlModel >( _rEvent.Source, UNO_QUERY ) )
+ );
+ OSL_ENSURE( maModels.end() != aPos, "UnoControlDialogModel::propertyChange: don't know this model!" );
+ if ( maModels.end() != aPos )
+ sAccessor = aPos->second;
+
+ // our groups are not up-to-date
+ mbGroupsUpToDate = sal_False;
+
+ // notify
+ implNotifyTabModelChange( sAccessor );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::disposing( const EventObject& /*rEvent*/ ) throw (RuntimeException)
+{
+}
+
+// ----------------------------------------------------------------------------
+void ControlModelContainerBase::startControlListening( const Reference< XControlModel >& _rxChildModel )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xModelProps.is() )
+ xPSI = xModelProps->getPropertySetInfo();
+
+ if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
+ xModelProps->addPropertyChangeListener( getTabIndexPropertyName(), this );
+}
+
+// ----------------------------------------------------------------------------
+void ControlModelContainerBase::stopControlListening( const Reference< XControlModel >& _rxChildModel )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xModelProps.is() )
+ xPSI = xModelProps->getPropertySetInfo();
+
+ if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
+ xModelProps->removePropertyChangeListener( getTabIndexPropertyName(), this );
+}
+
+// ============================================================================
+// = class ResourceListener
+// ============================================================================
+
+ResourceListener::ResourceListener(
+ const Reference< util::XModifyListener >& rListener ) :
+ OWeakObject(),
+ m_xListener( rListener ),
+ m_bListening( false )
+{
+}
+
+ResourceListener::~ResourceListener()
+{
+}
+
+// XInterface
+Any SAL_CALL ResourceListener::queryInterface( const Type& rType )
+throw ( RuntimeException )
+{
+ Any a = ::cppu::queryInterface(
+ rType ,
+ static_cast< XModifyListener* >( this ),
+ static_cast< XEventListener* >( this ));
+
+ if ( a.hasValue() )
+ return a;
+
+ return OWeakObject::queryInterface( rType );
+}
+
+void SAL_CALL ResourceListener::acquire() throw ()
+{
+ OWeakObject::acquire();
+}
+
+void SAL_CALL ResourceListener::release() throw ()
+{
+ OWeakObject::release();
+}
+
+void ResourceListener::startListening(
+ const Reference< resource::XStringResourceResolver >& rResource )
+{
+ Reference< util::XModifyBroadcaster > xModifyBroadcaster( rResource, UNO_QUERY );
+
+ {
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ bool bListening( m_bListening );
+ bool bResourceSet( m_xResource.is() );
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( bListening && bResourceSet )
+ stopListening();
+
+ // --- SAFE ---
+ aGuard.reset();
+ m_xResource = rResource;
+ aGuard.clear();
+ // --- SAFE ---
+ }
+
+ Reference< util::XModifyListener > xThis( static_cast<OWeakObject*>( this ), UNO_QUERY );
+ if ( xModifyBroadcaster.is() )
+ {
+ try
+ {
+ xModifyBroadcaster->addModifyListener( xThis );
+
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ m_bListening = true;
+ // --- SAFE ---
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+}
+
+void ResourceListener::stopListening()
+{
+ Reference< util::XModifyBroadcaster > xModifyBroadcaster;
+
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ if ( m_bListening && m_xResource.is() )
+ xModifyBroadcaster = Reference< util::XModifyBroadcaster >( m_xResource, UNO_QUERY );
+ aGuard.clear();
+ // --- SAFE ---
+
+ Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ if ( xModifyBroadcaster.is() )
+ {
+ try
+ {
+ // --- SAFE ---
+ aGuard.reset();
+ m_bListening = false;
+ m_xResource.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ xModifyBroadcaster->removeModifyListener( xThis );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+}
+
+// XModifyListener
+void SAL_CALL ResourceListener::modified(
+ const lang::EventObject& aEvent )
+throw ( RuntimeException )
+{
+ Reference< util::XModifyListener > xListener;
+
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ xListener = m_xListener;
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( xListener.is() )
+ {
+ try
+ {
+ xListener->modified( aEvent );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+}
+
+// XEventListener
+void SAL_CALL ResourceListener::disposing(
+ const EventObject& Source )
+throw ( RuntimeException )
+{
+ Reference< lang::XEventListener > xListener;
+ Reference< resource::XStringResourceResolver > xResource;
+
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ Reference< XInterface > xIfacRes( m_xResource, UNO_QUERY );
+ Reference< XInterface > xIfacList( m_xListener, UNO_QUERY );
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( Source.Source == xIfacRes )
+ {
+ // --- SAFE ---
+ aGuard.reset();
+ m_bListening = false;
+ xResource = m_xResource;
+ xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
+ m_xResource.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( xListener.is() )
+ {
+ try
+ {
+ xListener->disposing( Source );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+ }
+ else if ( Source.Source == xIfacList )
+ {
+ // --- SAFE ---
+ aGuard.reset();
+ m_bListening = false;
+ xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
+ xResource = m_xResource;
+ m_xResource.clear();
+ m_xListener.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ // Remove ourself as listener from resource resolver
+ Reference< util::XModifyBroadcaster > xModifyBroadcaster( xResource, UNO_QUERY );
+ Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ if ( xModifyBroadcaster.is() )
+ {
+ try
+ {
+ xModifyBroadcaster->removeModifyListener( xThis );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+ }
+}
+
+//===============================================================
+// ----------------------------------------------------
+// class DialogContainerControl
+// ----------------------------------------------------
+ControlContainerBase::ControlContainerBase() :
+ mbSizeModified(false),
+ mbPosModified(false)
+{
+ maComponentInfos.nWidth = 280;
+ maComponentInfos.nHeight = 400;
+ mxListener = new ResourceListener( Reference< util::XModifyListener >(
+ static_cast< OWeakObject* >( this ), UNO_QUERY ));
+}
+
+ControlContainerBase::~ControlContainerBase()
+{
+}
+
+void ControlContainerBase::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+}
+
+void ControlContainerBase::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
+{
+ Reference< XPropertySet > xP( rxModel, UNO_QUERY );
+
+ ::rtl::OUString aDefCtrl;
+ xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ Reference < XControl > xCtrl( xMSF->createInstance( aDefCtrl ), UNO_QUERY );
+
+ DBG_ASSERT( xCtrl.is(), "UnoDialogControl::ImplInsertControl: could not create the control!" );
+ if ( xCtrl.is() )
+ {
+ xCtrl->setModel( rxModel );
+ addControl( rName, xCtrl );
+ // will implicitly call addingControl, where we can add the PropertiesChangeListener to the model
+ // (which we formerly did herein)
+ // 08.01.2001 - 96008 - fs@openoffice.org
+
+ ImplSetPosSize( xCtrl );
+ }
+}
+
+void ControlContainerBase::ImplRemoveControl( Reference< XControlModel >& rxModel )
+{
+ Sequence< Reference< XControl > > aControls = getControls();
+ Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
+ if ( xCtrl.is() )
+ removeControl( xCtrl );
+}
+
+void ControlContainerBase::ImplSetPosSize( Reference< XControl >& rxCtrl )
+{
+ Reference< XPropertySet > xP( rxCtrl->getModel(), UNO_QUERY );
+
+ sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0;
+ xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) ) >>= nX;
+ xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) ) >>= nY;
+ xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
+ xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
+ MapMode aMode( MAP_APPFONT );
+ OutputDevice*pOutDev = Application::GetDefaultDevice();
+ if ( pOutDev )
+ {
+ ::Size aTmp( nX, nY );
+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
+ nX = aTmp.Width();
+ nY = aTmp.Height();
+ aTmp = ::Size( nWidth, nHeight );
+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
+ nWidth = aTmp.Width();
+ nHeight = aTmp.Height();
+ }
+ else
+ {
+ Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer( sal_True );
+ Reference< XDevice > xD( xPeer, UNO_QUERY );
+
+ SimpleFontMetric aFM;
+ FontDescriptor aFD;
+ Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
+ aVal >>= aFD;
+ if ( aFD.StyleName.getLength() )
+ {
+ Reference< XFont > xFont = xD->getFont( aFD );
+ aFM = xFont->getFontMetric();
+ }
+ else
+ {
+ Reference< XGraphics > xG = xD->createGraphics();
+ aFM = xG->getFontMetric();
+ }
+
+ sal_Int16 nH = aFM.Ascent + aFM.Descent;
+ sal_Int16 nW = nH/2; // calculate avarage width?!
+
+ nX *= nW;
+ nX /= 4;
+ nWidth *= nW;
+ nWidth /= 4;
+ nY *= nH;
+ nY /= 8;
+ nHeight *= nH;
+ nHeight /= 8;
+ }
+ Reference < XWindow > xW( rxCtrl, UNO_QUERY );
+ xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
+}
+
+void ControlContainerBase::dispose() throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
+ // Notify our listener helper about dispose
+ // --- SAFE ---
+ ::osl::ResettableGuard< ::osl::Mutex > aGuard( GetMutex() );
+ Reference< XEventListener > xListener( mxListener, UNO_QUERY );
+ mxListener.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( xListener.is() )
+ xListener->disposing( aEvt );
+ UnoControlContainer::dispose();
+}
+
+void SAL_CALL ControlContainerBase::disposing(
+ const EventObject& Source )
+throw(RuntimeException)
+{
+ UnoControlContainer::disposing( Source );
+}
+
+sal_Bool ControlContainerBase::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ // destroy the old tab controller, if existent
+ if ( mxTabController.is() )
+ {
+ mxTabController->setModel( NULL ); // just to be sure, should not be necessary
+ removeTabController( mxTabController );
+ ::comphelper::disposeComponent( mxTabController ); // just to be sure, should not be necessary
+ mxTabController.clear();
+ }
+
+ if ( getModel().is() )
+ {
+ Sequence< Reference< XControl > > aControls = getControls();
+ const Reference< XControl >* pCtrls = aControls.getConstArray();
+ const Reference< XControl >* pCtrlsEnd = pCtrls + aControls.getLength();
+
+ for ( ; pCtrls < pCtrlsEnd; ++pCtrls )
+ removeControl( *pCtrls );
+ // will implicitly call removingControl, which will remove the PropertyChangeListener
+ // (which we formerly did herein)
+ // 08.01.2001 - 96008 - fs@openoffice.org
+
+ Reference< XContainer > xC( getModel(), UNO_QUERY );
+ if ( xC.is() )
+ xC->removeContainerListener( this );
+
+ Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
+ if ( xChangeNotifier.is() )
+ xChangeNotifier->removeChangesListener( this );
+ }
+
+ sal_Bool bRet = UnoControl::setModel( rxModel );
+
+ if ( getModel().is() )
+ {
+ Reference< XNameAccess > xNA( getModel(), UNO_QUERY );
+ if ( xNA.is() )
+ {
+ Sequence< ::rtl::OUString > aNames = xNA->getElementNames();
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+ sal_uInt32 nCtrls = aNames.getLength();
+
+ Reference< XControlModel > xCtrlModel;
+ for( sal_uInt32 n = 0; n < nCtrls; ++n, ++pNames )
+ {
+ xNA->getByName( *pNames ) >>= xCtrlModel;
+ ImplInsertControl( xCtrlModel, *pNames );
+ }
+ }
+
+ Reference< XContainer > xC( getModel(), UNO_QUERY );
+ if ( xC.is() )
+ xC->addContainerListener( this );
+
+ Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
+ if ( xChangeNotifier.is() )
+ xChangeNotifier->addChangesListener( this );
+ }
+
+ Reference< XTabControllerModel > xTabbing( getModel(), UNO_QUERY );
+ if ( xTabbing.is() )
+ {
+ mxTabController = new StdTabController;
+ mxTabController->setModel( xTabbing );
+ addTabController( mxTabController );
+ }
+ ImplStartListingForResourceEvents();
+
+ return bRet;
+}
+void ControlContainerBase::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ UnoControl::setDesignMode( bOn );
+
+ Sequence< Reference< XControl > > xCtrls = getControls();
+ sal_Int32 nControls = xCtrls.getLength();
+ Reference< XControl >* pControls = xCtrls.getArray();
+ for ( sal_Int32 n = 0; n < nControls; n++ )
+ pControls[n]->setDesignMode( bOn );
+
+ // #109067# in design mode the tab controller is not notified about
+ // tab index changes, therefore the tab order must be activated
+ // when switching from design mode to live mode
+ if ( mxTabController.is() && !bOn )
+ mxTabController->activateTabOrder();
+}
+
+void ControlContainerBase::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xModel;
+ ::rtl::OUString aName;
+
+ Event.Accessor >>= aName;
+ Event.Element >>= xModel;
+ ImplInsertControl( xModel, aName );
+}
+
+void ControlContainerBase::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xModel;
+ Event.Element >>= xModel;
+ if ( xModel.is() )
+ ImplRemoveControl( xModel );
+}
+
+void ControlContainerBase::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xModel;
+ Event.ReplacedElement >>= xModel;
+ if ( xModel.is() )
+ ImplRemoveControl( xModel );
+
+ ::rtl::OUString aName;
+ Event.Accessor >>= aName;
+ Event.Element >>= xModel;
+ ImplInsertControl( xModel, aName );
+}
+
+// XPropertiesChangeListener
+void ControlContainerBase::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
+{
+ if( !isDesignMode() && !mbCreatingCompatiblePeer )
+ {
+ ::rtl::OUString s1( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
+ ::rtl::OUString s2( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
+ ::rtl::OUString s3( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
+ ::rtl::OUString s4( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
+
+ sal_Int32 nLen = rEvents.getLength();
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
+ Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
+ sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
+ if ( ( rEvt.PropertyName == s1 ) ||
+ ( rEvt.PropertyName == s2 ) ||
+ ( rEvt.PropertyName == s3 ) ||
+ ( rEvt.PropertyName == s4 ) )
+ {
+ if ( bOwnModel )
+ {
+ if ( !mbPosModified && !mbSizeModified )
+ {
+ // Don't set new pos/size if we get new values from window listener
+ Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
+ ImplSetPosSize( xThis );
+ }
+ }
+ else
+ {
+ Sequence<Reference<XControl> > aControlSequence(getControls());
+ Reference<XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
+ ImplSetPosSize( aControlRef );
+ }
+ break;
+ }
+ }
+ }
+
+ UnoControlContainer::ImplModelPropertiesChanged( rEvents );
+}
+
+void ControlContainerBase::addingControl( const Reference< XControl >& _rxControl )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ UnoControlContainer::addingControl( _rxControl );
+
+ if ( _rxControl.is() )
+ {
+ Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
+ if ( xProps.is() )
+ {
+ Sequence< ::rtl::OUString > aNames( 4 );
+ ::rtl::OUString* pNames = aNames.getArray();
+ *pNames++ = ::rtl::OUString::createFromAscii( "PositionX" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "PositionY" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "Width" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "Height" );
+
+ xProps->addPropertiesChangeListener( aNames, this );
+ }
+ }
+}
+
+void ControlContainerBase::removingControl( const Reference< XControl >& _rxControl )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ UnoControlContainer::removingControl( _rxControl );
+
+ if ( _rxControl.is() )
+ {
+ Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
+ if ( xProps.is() )
+ xProps->removePropertiesChangeListener( this );
+ }
+
+}
+
+void SAL_CALL ControlContainerBase::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // a tab controller model may have changed
+
+ // #109067# in design mode don't notify the tab controller
+ // about tab index changes
+ if ( mxTabController.is() && !mbDesignMode )
+ mxTabController->activateTabOrder();
+}
+void lcl_ApplyResolverToNestedContainees( const Reference< resource::XStringResourceResolver >& xStringResourceResolver, const Reference< XControlContainer >& xContainer )
+{
+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+
+ Any xNewStringResourceResolver; xNewStringResourceResolver <<= xStringResourceResolver;
+
+ Sequence< rtl::OUString > aPropNames(1);
+ aPropNames[0] = aPropName;
+
+ const Sequence< Reference< awt::XControl > > aSeq = xContainer->getControls();
+ for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ {
+ Reference< XControl > xControl( aSeq[i] );
+ Reference< XPropertySet > xPropertySet;
+
+ if ( xControl.is() )
+ xPropertySet = Reference< XPropertySet >( xControl->getModel(), UNO_QUERY );
+
+ if ( !xPropertySet.is() )
+ continue;
+
+ try
+ {
+ Reference< resource::XStringResourceResolver > xCurrStringResourceResolver;
+ Any aOldValue = xPropertySet->getPropertyValue( aPropName );
+ if ( ( aOldValue >>= xCurrStringResourceResolver )
+ && ( xStringResourceResolver == xCurrStringResourceResolver )
+ )
+ {
+ Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
+ Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
+ xMultiPropSet->firePropertiesChangeEvent( aPropNames, xListener );
+ }
+ else
+ xPropertySet->setPropertyValue( aPropName, xNewStringResourceResolver );
+ }
+ /*catch ( NoSuchElementException& )*/ // that's nonsense, this is never thrown above ...
+ catch ( const Exception& )
+ {
+ }
+
+ uno::Reference< XControlContainer > xNestedContainer( xControl, uno::UNO_QUERY );
+ if ( xNestedContainer.is() )
+ lcl_ApplyResolverToNestedContainees( xStringResourceResolver, xNestedContainer );
+
+ }
+
+}
+void ControlContainerBase::ImplStartListingForResourceEvents()
+{
+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
+
+ ImplGetPropertyValue( PROPERTY_RESOURCERESOLVER ) >>= xStringResourceResolver;
+
+ // Add our helper as listener to retrieve notifications about changes
+ Reference< util::XModifyListener > rListener( mxListener );
+ ResourceListener* pResourceListener = static_cast< ResourceListener* >( rListener.get() );
+
+ // resource listener will stop listening if resolver reference is empty
+ if ( pResourceListener )
+ pResourceListener->startListening( xStringResourceResolver );
+ ImplUpdateResourceResolver();
+}
+
+void ControlContainerBase::ImplUpdateResourceResolver()
+{
+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
+
+ ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
+ if ( !xStringResourceResolver.is() )
+ return;
+
+ lcl_ApplyResolverToNestedContainees( xStringResourceResolver, this );
+
+ // propagate resource resolver changes to language dependent props of the dialog
+ Reference< XPropertySet > xPropertySet( getModel(), UNO_QUERY );
+ if ( xPropertySet.is() )
+ {
+ Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
+ Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
+ xMultiPropSet->firePropertiesChangeEvent( lcl_getLanguageDependentProperties(), xListener );
+ }
+}
+
+
+uno::Reference< graphic::XGraphic > ControlContainerBase::Impl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
+{
+ uno::Reference< graphic::XGraphic > xGraphic;
+ if ( !_rURL.getLength() )
+ return xGraphic;
+
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< graphic::XGraphicProvider > xProvider;
+ if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ {
+ uno::Sequence< beans::PropertyValue > aMediaProperties(1);
+ aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+ aMediaProperties[0].Value <<= _rURL;
+ xGraphic = xProvider->queryGraphic( aMediaProperties );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return xGraphic;
+}
+//// ----------------------------------------------------
+//// Helper Method to convert relative url to physical location
+//// ----------------------------------------------------
+
+::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
+{
+
+ ::rtl::OUString baseLocation;
+ ::rtl::OUString url;
+
+ rbase >>= baseLocation;
+ rUrl >>= url;
+
+ ::rtl::OUString absoluteURL( url );
+ if ( url.getLength() > 0 )
+ {
+ INetURLObject urlObj(baseLocation);
+ urlObj.removeSegment();
+ baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
+
+ const INetURLObject protocolCheck( url );
+ const INetProtocol protocol = protocolCheck.GetProtocol();
+ if ( protocol == INET_PROT_NOT_VALID )
+ {
+ ::rtl::OUString testAbsoluteURL;
+ if ( ::osl::FileBase::E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) )
+ absoluteURL = testAbsoluteURL;
+ }
+ }
+
+ return absoluteURL;
+}
+
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index ecb4d7765723..7a7f7444645b 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -35,17 +35,7 @@
#include <toolkit/controls/dialogcontrol.hxx>
#include <toolkit/helper/property.hxx>
#include <toolkit/helper/unopropertyarrayhelper.hxx>
-#include <toolkit/controls/geometrycontrolmodel.hxx>
-#include <toolkit/controls/unocontrols.hxx>
-#include "toolkit/controls/formattedcontrol.hxx"
-#include "toolkit/controls/roadmapcontrol.hxx"
-#ifndef TOOLKIT_INC_TOOLKIT_CONTROLS_TKSCROLLBAR_HXX
-#include "toolkit/controls/tkscrollbar.hxx"
-#endif
#include <toolkit/controls/stdtabcontroller.hxx>
-#include <toolkit/controls/tksimpleanimation.hxx>
-#include <toolkit/controls/tkthrobber.hxx>
-
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/WindowAttribute.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
@@ -54,20 +44,14 @@
#include <cppuhelper/typeprovider.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
-#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
-#include <comphelper/types.hxx>
-#include <comphelper/componentcontext.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <vcl/graph.hxx>
#include <vcl/image.hxx>
-
-#include "tree/treecontrol.hxx"
-#include "grid/gridcontrol.hxx"
-
#include <map>
#include <algorithm>
#include <functional>
@@ -81,180 +65,18 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::util;
-using namespace toolkit;
-#define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ))
#define PROPERTY_DIALOGSOURCEURL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogSourceURL" ))
#define PROPERTY_IMAGEURL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ImageURL" ))
#define PROPERTY_GRAPHIC ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Graphic" ))
-
-//HELPER
+//
+////HELPER
::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
-struct LanguageDependentProp
-{
- const char* pPropName;
- sal_Int32 nPropNameLength;
-};
-
-// ----------------------------------------------------------------------------
-namespace
-{
- static const Sequence< ::rtl::OUString >& lcl_getLanguageDependentProperties()
- {
- static Sequence< ::rtl::OUString > s_aLanguageDependentProperties;
- if ( s_aLanguageDependentProperties.getLength() == 0 )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( s_aLanguageDependentProperties.getLength() == 0 )
- {
- s_aLanguageDependentProperties.realloc( 2 );
- s_aLanguageDependentProperties[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) );
- s_aLanguageDependentProperties[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
- // note: properties must be sorted
- }
- }
- return s_aLanguageDependentProperties;
- }
-
- static uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
- {
- uno::Reference< graphic::XGraphic > xGraphic;
- if ( !_rURL.getLength() )
- return xGraphic;
-
- try
- {
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- uno::Reference< graphic::XGraphicProvider > xProvider;
- if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
- {
- uno::Sequence< beans::PropertyValue > aMediaProperties(1);
- aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
- aMediaProperties[0].Value <<= _rURL;
- xGraphic = xProvider->queryGraphic( aMediaProperties );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return xGraphic;
- }
-
-}
-
-// ----------------------------------------------------------------------------
-// functor for disposing a control model
-struct DisposeControlModel : public ::std::unary_function< Reference< XControlModel >, void >
-{
- void operator()( Reference< XControlModel >& _rxModel )
- {
- try
- {
- ::comphelper::disposeComponent( _rxModel );
- }
- catch( const Exception& )
- {
- DBG_ERROR( "DisposeControlModel::(): caught an exception while disposing a component!" );
- }
- }
-};
-
-// ----------------------------------------------------------------------------
-// functor for searching control model by name
-struct FindControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, bool >
-{
-private:
- const ::rtl::OUString& m_rName;
-
-public:
- FindControlModel( const ::rtl::OUString& _rName ) : m_rName( _rName ) { }
-
- bool operator()( const UnoControlDialogModel::UnoControlModelHolder& _rCompare )
- {
- return ( _rCompare.second == m_rName ) ? true : false;
- }
-};
-
-// ----------------------------------------------------------------------------
-// functor for cloning a control model, and insertion into a target list
-struct CloneControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, void >
-{
-private:
- UnoControlDialogModel::UnoControlModelHolderList& m_rTargetList;
-
-public:
- CloneControlModel( UnoControlDialogModel::UnoControlModelHolderList& _rTargetList )
- :m_rTargetList( _rTargetList )
- {
- }
-
- void operator()( const UnoControlDialogModel::UnoControlModelHolder& _rSource )
- {
- // clone the source object
- Reference< XCloneable > xCloneSource( _rSource.first, UNO_QUERY );
- Reference< XControlModel > xClone( xCloneSource->createClone(), UNO_QUERY );
- // add to target list
- m_rTargetList.push_back( UnoControlDialogModel::UnoControlModelHolder( xClone, _rSource.second ) );
- }
-};
-
-// ----------------------------------------------------------------------------
-// functor for comparing a XControlModel with a given reference
-struct CompareControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, bool >
-{
-private:
- Reference< XControlModel > m_xReference;
-public:
- CompareControlModel( const Reference< XControlModel >& _rxReference ) : m_xReference( _rxReference ) { }
-
- bool operator()( const UnoControlDialogModel::UnoControlModelHolder& _rCompare )
- {
- return ( _rCompare.first.get() == m_xReference.get() ) ? true : false;
- }
-};
-
-// ----------------------------------------------------------------------------
-static void lcl_throwIllegalArgumentException( )
-{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
- throw IllegalArgumentException();
-}
-
-// ----------------------------------------------------------------------------
-static void lcl_throwNoSuchElementException( )
-{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
- throw NoSuchElementException();
-}
-
-// ----------------------------------------------------------------------------
-static void lcl_throwElementExistException( )
-{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
- throw ElementExistException();
-}
-
-// ----------------------------------------------------------------------------
-static const ::rtl::OUString& getTabIndexPropertyName( )
-{
- static const ::rtl::OUString s_sTabIndexProperty( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) );
- return s_sTabIndexProperty;
-}
-
-// ----------------------------------------------------------------------------
-static const ::rtl::OUString& getStepPropertyName( )
-{
- static const ::rtl::OUString s_sStepProperty( RTL_CONSTASCII_USTRINGPARAM( "Step" ) );
- return s_sStepProperty;
-}
-
// ----------------------------------------------------
// class UnoControlDialogModel
// ----------------------------------------------------
UnoControlDialogModel::UnoControlDialogModel()
- :maContainerListeners( *this )
- ,maChangeListeners ( GetMutex() )
- ,mbGroupsUpToDate( sal_False )
{
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
// ImplRegisterProperty( BASEPROPERTY_BORDER );
@@ -279,35 +101,14 @@ UnoControlDialogModel::UnoControlDialogModel()
}
UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
- : UnoControlDialogModel_IBase( rModel )
- , UnoControlDialogModel_Base( rModel )
- , maContainerListeners( *this )
- , maChangeListeners ( GetMutex() )
- , mbGroupsUpToDate( sal_False )
+ : ControlModelContainerBase( rModel )
{
}
UnoControlDialogModel::~UnoControlDialogModel()
{
- maModels.clear();
- mbGroupsUpToDate = sal_False;
}
-Any UnoControlDialogModel::queryAggregation( const Type & rType ) throw(RuntimeException)
-{
- Any aRet( UnoControlDialogModel_IBase::queryInterface( rType ) );
- return (aRet.hasValue() ? aRet : UnoControlDialogModel_Base::queryAggregation( rType ));
-}
-
-// XTypeProvider
-IMPL_IMPLEMENTATION_ID( UnoControlDialogModel )
-Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException)
-{
- return ::comphelper::concatSequences(
- UnoControlDialogModel_IBase::getTypes(),
- UnoControlDialogModel_Base::getTypes()
- );
-}
::rtl::OUString UnoControlDialogModel::getServiceName( ) throw(RuntimeException)
{
@@ -341,42 +142,6 @@ Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return *pHelper;
}
-void SAL_CALL UnoControlDialogModel::dispose( ) throw(RuntimeException)
-{
- // ====================================================================
- // tell our listeners
- {
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- EventObject aDisposeEvent;
- aDisposeEvent.Source = static_cast< XAggregation* >( static_cast< ::cppu::OWeakAggObject* >( this ) );
-
- maContainerListeners.disposeAndClear( aDisposeEvent );
- maChangeListeners.disposeAndClear( aDisposeEvent );
- }
-
- // ====================================================================
- // call the base class
- UnoControlModel::dispose();
-
- // ====================================================================
- // dispose our child models
- // for this, collect the models (we collect them from maModels, and this is modified when disposing children)
- ::std::vector< Reference< XControlModel > > aChildModels( maModels.size() );
-
- ::std::transform(
- maModels.begin(), maModels.end(), // source range
- aChildModels.begin(), // target location
- ::std::select1st< UnoControlModelHolder >( ) // operation to apply -> select the XControlModel part
- );
-
- // now dispose
- ::std::for_each( aChildModels.begin(), aChildModels.end(), DisposeControlModel() );
- aChildModels.clear();
-
- mbGroupsUpToDate = sal_False;
-}
-
// XMultiPropertySet
Reference< XPropertySetInfo > UnoControlDialogModel::getPropertySetInfo( ) throw(RuntimeException)
{
@@ -384,961 +149,20 @@ Reference< XPropertySetInfo > UnoControlDialogModel::getPropertySetInfo( ) thro
return xInfo;
}
-UnoControlModel* UnoControlDialogModel::Clone() const
-{
- // clone the container itself
- UnoControlDialogModel* pClone = new UnoControlDialogModel( *this );
-
- // clone all children
- ::std::for_each(
- maModels.begin(), maModels.end(),
- CloneControlModel( pClone->maModels )
- );
-
- return pClone;
-}
-
-UnoControlDialogModel::UnoControlModelHolderList::iterator UnoControlDialogModel::ImplFindElement( const ::rtl::OUString& rName )
-{
- return ::std::find_if( maModels.begin(), maModels.end(), FindControlModel( rName ) );
-}
-
-// ::XMultiServiceFactory
-Reference< XInterface > UnoControlDialogModel::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(Exception, RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- OGeometryControlModel_Base* pNewModel = NULL;
-
- if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlEditModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlEditModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFormattedFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFormattedFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFileControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFileControlModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlButtonModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlButtonModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlImageControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlImageControlModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRadioButtonModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlRadioButtonModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCheckBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlCheckBoxModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedHyperlinkModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedHyperlinkModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedTextModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedTextModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlGroupBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlGroupBoxModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlListBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlListBoxModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlComboBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlComboBoxModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlDateFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlDateFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlTimeFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlTimeFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlNumericFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlNumericFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCurrencyFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlCurrencyFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlPatternFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlPatternFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlProgressBarModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlProgressBarModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlScrollBarModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlScrollBarModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedLineModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedLineModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRoadmapModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlRoadmapModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName_TreeControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoTreeModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoGridModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoSimpleAnimationControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoSimpleAnimationControlModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoThrobberControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoThrobberControlModel >;
-
- if ( !pNewModel )
- {
- Reference< XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() );
- if ( xORB.is() )
- {
- Reference< XInterface > xObject = xORB->createInstance( aServiceSpecifier );
- Reference< XServiceInfo > xSI( xObject, UNO_QUERY );
- Reference< XCloneable > xCloneAccess( xSI, UNO_QUERY );
- Reference< XAggregation > xAgg( xCloneAccess, UNO_QUERY );
- if ( xAgg.is() )
- {
- if ( xSI->supportsService( ::rtl::OUString::createFromAscii( "com.sun.star.awt.UnoControlModel" ) ) )
- {
- // release 3 of the 4 references we have to the object
- xAgg.clear();
- xSI.clear();
- xObject.clear();
-
- pNewModel = new OCommonGeometryControlModel( xCloneAccess, aServiceSpecifier );
- }
- }
- }
- }
-
- Reference< XInterface > xNewModel = (::cppu::OWeakObject*)pNewModel;
- return xNewModel;
-}
-
-Reference< XInterface > UnoControlDialogModel::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& /* Arguments */ ) throw(Exception, RuntimeException)
-{
- return createInstance( ServiceSpecifier );
-}
-
-Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() throw(RuntimeException)
-{
- static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
- if ( !pNamesSeq )
- {
- pNamesSeq = new Sequence< ::rtl::OUString >( 24 );
- ::rtl::OUString* pNames = pNamesSeq->getArray();
- pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel );
- pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel );
- pNames[2] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel );
- pNames[3] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel );
- pNames[4] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel );
- pNames[5] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel );
- pNames[6] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel );
- pNames[7] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel );
- pNames[8] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel );
- pNames[9] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel );
- pNames[10] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel );
- pNames[11] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel );
- pNames[12] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel );
- pNames[13] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel );
- pNames[14] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel );
- pNames[15] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel );
- pNames[16] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlProgressBarModel );
- pNames[17] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlScrollBarModel );
- pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel );
- pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel );
- pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel );
- pNames[21] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
- pNames[22] = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel );
- pNames[23] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControlModel );
- }
- return *pNamesSeq;
-}
-
-// XContainer
-void UnoControlDialogModel::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
-{
- maContainerListeners.addInterface( l );
-}
-
-void UnoControlDialogModel::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
-{
- maContainerListeners.removeInterface( l );
-}
-
-// XElementAcces
-Type UnoControlDialogModel::getElementType() throw(RuntimeException)
-{
- Type aType = getCppuType( ( Reference< XControlModel>* ) NULL );
- return aType;
-}
-
-sal_Bool UnoControlDialogModel::hasElements() throw(RuntimeException)
-{
- return !maModels.empty();
-}
-
-// XNameContainer, XNameReplace, XNameAccess
-void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XControlModel > xNewModel;
- aElement >>= xNewModel;
- if ( !xNewModel.is() )
- lcl_throwIllegalArgumentException();
-
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
- if ( maModels.end() == aElementPos )
- lcl_throwNoSuchElementException();
-
- // stop listening at the old model
- stopControlListening( aElementPos->first );
- Reference< XControlModel > xReplaced( aElementPos->first );
- // remember the new model, and start listening
- aElementPos->first = xNewModel;
- startControlListening( xNewModel );
-
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element = aElement;
- aEvent.ReplacedElement <<= xReplaced;
- aEvent.Accessor <<= aName;
-
- // notify the container listener
- maContainerListeners.elementReplaced( aEvent );
-
- // our "tab controller model" has potentially changed -> notify this
- implNotifyTabModelChange( aName );
-}
-
-Any UnoControlDialogModel::getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-{
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
- if ( maModels.end() == aElementPos )
- lcl_throwNoSuchElementException();
-
- return makeAny( aElementPos->first );
-}
-
-Sequence< ::rtl::OUString > UnoControlDialogModel::getElementNames() throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aNames( maModels.size() );
-
- ::std::transform(
- maModels.begin(), maModels.end(), // source range
- aNames.getArray(), // target range
- ::std::select2nd< UnoControlModelHolder >() // operator to apply: select the second element (the name)
- );
-
- return aNames;
-}
-
-sal_Bool UnoControlDialogModel::hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
-{
- return maModels.end() != ImplFindElement( aName );
-}
-
-void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XControlModel > xM;
- aElement >>= xM;
-
- if ( xM.is() )
- {
- Reference< beans::XPropertySet > xProps( xM, UNO_QUERY );
- if ( xProps.is() )
- {
-
- Reference< beans::XPropertySetInfo > xPropInfo = xProps.get()->getPropertySetInfo();
-
- ::rtl::OUString sImageSourceProperty = GetPropertyName( BASEPROPERTY_IMAGEURL );
- if ( xPropInfo.get()->hasPropertyByName( sImageSourceProperty ))
- {
- Any aUrl = xProps.get()->getPropertyValue( sImageSourceProperty );
-
- ::rtl::OUString absoluteUrl =
- getPhysicalLocation( getPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL ) ), aUrl );
-
- aUrl <<= absoluteUrl;
-
- xProps.get()->setPropertyValue( sImageSourceProperty , aUrl );
- }
- }
- }
-
-
-
- if ( !aName.getLength() || !xM.is() )
- lcl_throwIllegalArgumentException();
-
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
- if ( maModels.end() != aElementPos )
- lcl_throwElementExistException();
-
- maModels.push_back( UnoControlModelHolder( xM, aName ) );
- mbGroupsUpToDate = sal_False;
- startControlListening( xM );
-
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= aElement;
- aEvent.Accessor <<= aName;
- maContainerListeners.elementInserted( aEvent );
-
- // our "tab controller model" has potentially changed -> notify this
- implNotifyTabModelChange( aName );
-}
-
-void UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
- if ( maModels.end() == aElementPos )
- lcl_throwNoSuchElementException();
-
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= aElementPos->first;
- aEvent.Accessor <<= aName;
- maContainerListeners.elementRemoved( aEvent );
-
- stopControlListening( aElementPos->first );
- Reference< XPropertySet > xPS( aElementPos->first, UNO_QUERY );
- maModels.erase( aElementPos );
- mbGroupsUpToDate = sal_False;
-
- if ( xPS.is() )
- try
- {
- xPS->setPropertyValue( PROPERTY_RESOURCERESOLVER, makeAny( Reference< resource::XStringResourceResolver >() ) );
- }
- catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
-
- // our "tab controller model" has potentially changed -> notify this
- implNotifyTabModelChange( aName );
-}
-
-// ----------------------------------------------------------------------------
-sal_Bool SAL_CALL UnoControlDialogModel::getGroupControl( ) throw (RuntimeException)
-{
- return sal_True;
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::setGroupControl( sal_Bool ) throw (RuntimeException)
-{
- DBG_ERROR( "UnoControlDialogModel::setGroupControl: explicit grouping not supported" );
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::setControlModels( const Sequence< Reference< XControlModel > >& _rControls ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- // set the tab indexes according to the order of models in the sequence
- const Reference< XControlModel >* pControls = _rControls.getConstArray( );
- const Reference< XControlModel >* pControlsEnd = _rControls.getConstArray( ) + _rControls.getLength();
-
- sal_Int16 nTabIndex = 1;
-
- for ( ; pControls != pControlsEnd; ++pControls )
- {
- // look up the control in our own structure. This is to prevent invalid arguments
- UnoControlModelHolderList::const_iterator aPos =
- ::std::find_if(
- maModels.begin(), maModels.end(),
- CompareControlModel( *pControls )
- );
- if ( maModels.end() != aPos )
- {
- // okay, this is an existent model
- // now set the TabIndex property (if applicable)
- Reference< XPropertySet > xProps( aPos->first, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI;
- if ( xProps.is() )
- xPSI = xProps->getPropertySetInfo();
- if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
- xProps->setPropertyValue( getTabIndexPropertyName(), makeAny( nTabIndex++ ) );
- }
- mbGroupsUpToDate = sal_False;
- }
-}
-
-
-typedef ::std::multimap< sal_Int32, Reference< XControlModel >, ::std::less< sal_Int32 > > MapIndexToModel;
-
-// ----------------------------------------------------------------------------
-Sequence< Reference< XControlModel > > SAL_CALL UnoControlDialogModel::getControlModels( ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- MapIndexToModel aSortedModels;
- // will be the sorted container of all models which have a tab index property
- ::std::vector< Reference< XControlModel > > aUnindexedModels;
- // will be the container of all models which do not have a tab index property
-
- UnoControlModelHolderList::const_iterator aLoop = maModels.begin();
- for ( ; aLoop != maModels.end(); ++aLoop )
- {
- Reference< XControlModel > xModel( aLoop->first );
-
- // see if the model has a TabIndex property
- Reference< XPropertySet > xControlProps( xModel, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI;
- if ( xControlProps.is() )
- xPSI = xControlProps->getPropertySetInfo( );
- DBG_ASSERT( xPSI.is(), "UnoControlDialogModel::getControlModels: invalid child model!" );
-
- // has it?
- if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
- { // yes
- sal_Int32 nTabIndex = -1;
- xControlProps->getPropertyValue( getTabIndexPropertyName() ) >>= nTabIndex;
-
- aSortedModels.insert( MapIndexToModel::value_type( nTabIndex, xModel ) );
- }
- else if ( xModel.is() )
- // no, it hasn't, but we have to include it, anyway
- aUnindexedModels.push_back( xModel );
- }
-
- // okay, here we have a container of all our models, sorted by tab index,
- // plus a container of "unindexed" models
- // -> merge them
- Sequence< Reference< XControlModel > > aReturn( aUnindexedModels.size() + aSortedModels.size() );
- ::std::transform(
- aSortedModels.begin(), aSortedModels.end(),
- ::std::copy( aUnindexedModels.begin(), aUnindexedModels.end(), aReturn.getArray() ),
- ::std::select2nd< MapIndexToModel::value_type >( )
- );
-
- return aReturn;
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::setGroup( const Sequence< Reference< XControlModel > >&, const ::rtl::OUString& ) throw (RuntimeException)
-{
- // not supported. We have only implicit grouping:
- // We only have a sequence of control models, and we _know_ (yes, that's a HACK relying on
- // implementation details) that VCL does grouping according to the order of controls automatically
- // At least VCL does this for all we're interested in: Radio buttons.
- DBG_ERROR( "UnoControlDialogModel::setGroup: grouping not supported" );
-}
-
-// ----------------------------------------------------------------------------
-namespace
-{
- enum GroupingMachineState
- {
- eLookingForGroup,
- eExpandingGroup
- };
-
- // ........................................................................
- static sal_Int32 lcl_getDialogStep( const Reference< XControlModel >& _rxModel )
- {
- sal_Int32 nStep = 0;
- try
- {
- Reference< XPropertySet > xModelProps( _rxModel, UNO_QUERY );
- xModelProps->getPropertyValue( getStepPropertyName() ) >>= nStep;
- }
- catch( const Exception& )
- {
- DBG_ERROR( "lcl_getDialogStep: caught an exception while determining the dialog page!" );
- }
- return nStep;
- }
-}
-
-// ----------------------------------------------------------------------------
-sal_Int32 SAL_CALL UnoControlDialogModel::getGroupCount( ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- implUpdateGroupStructure();
-
- return maGroups.size();
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::getGroup( sal_Int32 _nGroup, Sequence< Reference< XControlModel > >& _rGroup, ::rtl::OUString& _rName ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- implUpdateGroupStructure();
-
- if ( ( _nGroup < 0 ) || ( _nGroup >= (sal_Int32)maGroups.size() ) )
- {
- DBG_ERROR( "UnoControlDialogModel::getGroup: invalid argument and I am not allowed to throw an exception!" );
- _rGroup.realloc( 0 );
- _rName = ::rtl::OUString();
- }
- else
- {
- AllGroups::const_iterator aGroupPos = maGroups.begin() + _nGroup;
- _rGroup.realloc( aGroupPos->size() );
- // copy the models
- ::std::copy( aGroupPos->begin(), aGroupPos->end(), _rGroup.getArray() );
- // give the group a name
- _rName = ::rtl::OUString::valueOf( _nGroup );
- }
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::getGroupByName( const ::rtl::OUString& _rName, Sequence< Reference< XControlModel > >& _rGroup ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- ::rtl::OUString sDummyName;
- getGroup( _rName.toInt32( ), _rGroup, sDummyName );
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::addChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
-{
- maChangeListeners.addInterface( _rxListener );
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::removeChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
-{
- maChangeListeners.removeInterface( _rxListener );
-}
-
-// ----------------------------------------------------------------------------
-void UnoControlDialogModel::implNotifyTabModelChange( const ::rtl::OUString& _rAccessor )
-{
- // multiplex to our change listeners:
- // the changes event
- ChangesEvent aEvent;
- aEvent.Source = *this;
- aEvent.Base <<= aEvent.Source; // the "base of the changes root" is also ourself
- aEvent.Changes.realloc( 1 ); // exactly one change
- aEvent.Changes[ 0 ].Accessor <<= _rAccessor;
-
-
- Sequence< Reference< XInterface > > aChangeListeners( maChangeListeners.getElements() );
- const Reference< XInterface >* pListener = aChangeListeners.getConstArray();
- const Reference< XInterface >* pListenerEnd = aChangeListeners.getConstArray() + aChangeListeners.getLength();
- for ( ; pListener != pListenerEnd; ++pListener )
- {
- if ( pListener->is() )
- static_cast< XChangesListener* >( pListener->get() )->changesOccurred( aEvent );
- }
-}
-
-
-// ----------------------------------------------------------------------------
-void UnoControlDialogModel::implUpdateGroupStructure()
-{
- if ( mbGroupsUpToDate )
- // nothing to do
- return;
-
- // conditions for a group:
- // * all elements of the group are radio buttons
- // * all elements of the group are on the same dialog page
- // * in the overall control order (determined by the tab index), all elements are subsequent
-
- maGroups.clear();
-
- Sequence< Reference< XControlModel > > aControlModels = getControlModels();
- const Reference< XControlModel >* pControlModels = aControlModels.getConstArray();
- const Reference< XControlModel >* pControlModelsEnd = pControlModels + aControlModels.getLength();
-
- // in extreme we have as much groups as controls
- maGroups.reserve( aControlModels.getLength() );
-
- GroupingMachineState eState = eLookingForGroup; // the current state of our machine
- Reference< XServiceInfo > xModelSI; // for checking for a radion button
- AllGroups::iterator aCurrentGroup = maGroups.end(); // the group which we're currently building
- sal_Int32 nCurrentGroupStep = -1; // the step which all controls of the current group belong to
- sal_Bool bIsRadioButton; // is it a radio button?
-
-#if OSL_DEBUG_LEVEL > 1
- ::std::vector< ::rtl::OUString > aCurrentGroupLabels;
-#endif
-
- for ( ; pControlModels != pControlModelsEnd; ++pControlModels )
- {
- // we'll need this in every state
- xModelSI = xModelSI.query( *pControlModels );
- bIsRadioButton = xModelSI.is() && xModelSI->supportsService( ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) );
-
- switch ( eState )
- {
- case eLookingForGroup:
- {
- if ( !bIsRadioButton )
- // this is no radio button -> still looking for the beginning of a group
- continue;
- // the current model is a radio button
- // -> we found the beginning of a new group
- // create the place for this group
- size_t nGroups = maGroups.size();
- maGroups.resize( nGroups + 1 );
- aCurrentGroup = maGroups.begin() + nGroups;
- // and add the (only, til now) member
- aCurrentGroup->push_back( *pControlModels );
-
- // get the step which all controls of this group now have to belong to
- nCurrentGroupStep = lcl_getDialogStep( *pControlModels );
- // new state: looking for further members
- eState = eExpandingGroup;
-
-#if OSL_DEBUG_LEVEL > 1
- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
- ::rtl::OUString sLabel;
- if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
- xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
- aCurrentGroupLabels.push_back( sLabel );
-#endif
- }
- break;
-
- case eExpandingGroup:
- {
- if ( !bIsRadioButton )
- { // no radio button -> the group is done
- aCurrentGroup = maGroups.end();
- eState = eLookingForGroup;
-#if OSL_DEBUG_LEVEL > 1
- aCurrentGroupLabels.clear();
-#endif
- continue;
- }
-
- // it is a radio button - is it on the proper page?
- const sal_Int32 nThisModelStep = lcl_getDialogStep( *pControlModels );
- if ( ( nThisModelStep == nCurrentGroupStep ) // the current button is on the same dialog page
- || ( 0 == nThisModelStep ) // the current button appears on all pages
- )
- {
- // -> it belongs to the same group
- aCurrentGroup->push_back( *pControlModels );
- // state still is eExpandingGroup - we're looking for further elements
- eState = eExpandingGroup;
-
-#if OSL_DEBUG_LEVEL > 1
- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
- ::rtl::OUString sLabel;
- if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
- xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
- aCurrentGroupLabels.push_back( sLabel );
-#endif
- continue;
- }
-
- // it's a radio button, but on a different page
- // -> we open a new group for it
-
- // close the old group
- aCurrentGroup = maGroups.end();
-#if OSL_DEBUG_LEVEL > 1
- aCurrentGroupLabels.clear();
-#endif
-
- // open a new group
- size_t nGroups = maGroups.size();
- maGroups.resize( nGroups + 1 );
- aCurrentGroup = maGroups.begin() + nGroups;
- // and add the (only, til now) member
- aCurrentGroup->push_back( *pControlModels );
-
- nCurrentGroupStep = nThisModelStep;
-
- // state is the same: we still are looking for further elements of the current group
- eState = eExpandingGroup;
-#if OSL_DEBUG_LEVEL > 1
- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
- ::rtl::OUString sLabel;
- if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
- xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
- aCurrentGroupLabels.push_back( sLabel );
-#endif
- }
- break;
- }
- }
-
- mbGroupsUpToDate = sal_True;
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::propertyChange( const PropertyChangeEvent& _rEvent ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- DBG_ASSERT( 0 == _rEvent.PropertyName.compareToAscii( "TabIndex" ),
- "UnoControlDialogModel::propertyChange: not listening for this property!" );
-
- // the accessor for the changed element
- ::rtl::OUString sAccessor;
- UnoControlModelHolderList::const_iterator aPos =
- ::std::find_if(
- maModels.begin(), maModels.end(),
- CompareControlModel( Reference< XControlModel >( _rEvent.Source, UNO_QUERY ) )
- );
- OSL_ENSURE( maModels.end() != aPos, "UnoControlDialogModel::propertyChange: don't know this model!" );
- if ( maModels.end() != aPos )
- sAccessor = aPos->second;
-
- // our groups are not up-to-date
- mbGroupsUpToDate = sal_False;
-
- // notify
- implNotifyTabModelChange( sAccessor );
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::disposing( const EventObject& /*rEvent*/ ) throw (RuntimeException)
-{
-}
-
-// ----------------------------------------------------------------------------
-void UnoControlDialogModel::startControlListening( const Reference< XControlModel >& _rxChildModel )
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI;
- if ( xModelProps.is() )
- xPSI = xModelProps->getPropertySetInfo();
-
- if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
- xModelProps->addPropertyChangeListener( getTabIndexPropertyName(), this );
-}
-
-// ----------------------------------------------------------------------------
-void UnoControlDialogModel::stopControlListening( const Reference< XControlModel >& _rxChildModel )
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI;
- if ( xModelProps.is() )
- xPSI = xModelProps->getPropertySetInfo();
-
- if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
- xModelProps->removePropertyChangeListener( getTabIndexPropertyName(), this );
-}
-
-// ============================================================================
-// = class ResourceListener
-// ============================================================================
-
-ResourceListener::ResourceListener(
- const Reference< util::XModifyListener >& rListener ) :
- OWeakObject(),
- m_xListener( rListener ),
- m_bListening( false )
-{
-}
-
-ResourceListener::~ResourceListener()
-{
-}
-
-// XInterface
-Any SAL_CALL ResourceListener::queryInterface( const Type& rType )
-throw ( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- rType ,
- static_cast< XModifyListener* >( this ),
- static_cast< XEventListener* >( this ));
-
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
-}
-
-void SAL_CALL ResourceListener::acquire() throw ()
-{
- OWeakObject::acquire();
-}
-
-void SAL_CALL ResourceListener::release() throw ()
-{
- OWeakObject::release();
-}
-
-void ResourceListener::startListening(
- const Reference< resource::XStringResourceResolver >& rResource )
-{
- Reference< util::XModifyBroadcaster > xModifyBroadcaster( rResource, UNO_QUERY );
-
- {
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- bool bListening( m_bListening );
- bool bResourceSet( m_xResource.is() );
- aGuard.clear();
- // --- SAFE ---
-
- if ( bListening && bResourceSet )
- stopListening();
-
- // --- SAFE ---
- aGuard.reset();
- m_xResource = rResource;
- aGuard.clear();
- // --- SAFE ---
- }
-
- Reference< util::XModifyListener > xThis( static_cast<OWeakObject*>( this ), UNO_QUERY );
- if ( xModifyBroadcaster.is() )
- {
- try
- {
- xModifyBroadcaster->addModifyListener( xThis );
-
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- m_bListening = true;
- // --- SAFE ---
- }
- catch ( RuntimeException& )
- {
- throw;
- }
- catch ( Exception& )
- {
- }
- }
-}
-
-void ResourceListener::stopListening()
-{
- Reference< util::XModifyBroadcaster > xModifyBroadcaster;
-
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- if ( m_bListening && m_xResource.is() )
- xModifyBroadcaster = Reference< util::XModifyBroadcaster >( m_xResource, UNO_QUERY );
- aGuard.clear();
- // --- SAFE ---
-
- Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- if ( xModifyBroadcaster.is() )
- {
- try
- {
- // --- SAFE ---
- aGuard.reset();
- m_bListening = false;
- m_xResource.clear();
- aGuard.clear();
- // --- SAFE ---
-
- xModifyBroadcaster->removeModifyListener( xThis );
- }
- catch ( RuntimeException& )
- {
- throw;
- }
- catch ( Exception& )
- {
- }
- }
-}
-
-// XModifyListener
-void SAL_CALL ResourceListener::modified(
- const lang::EventObject& aEvent )
-throw ( RuntimeException )
-{
- Reference< util::XModifyListener > xListener;
-
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- xListener = m_xListener;
- aGuard.clear();
- // --- SAFE ---
-
- if ( xListener.is() )
- {
- try
- {
- xListener->modified( aEvent );
- }
- catch ( RuntimeException& )
- {
- throw;
- }
- catch ( Exception& )
- {
- }
- }
-}
-
-// XEventListener
-void SAL_CALL ResourceListener::disposing(
- const EventObject& Source )
-throw ( RuntimeException )
-{
- Reference< lang::XEventListener > xListener;
- Reference< resource::XStringResourceResolver > xResource;
-
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- Reference< XInterface > xIfacRes( m_xResource, UNO_QUERY );
- Reference< XInterface > xIfacList( m_xListener, UNO_QUERY );
- aGuard.clear();
- // --- SAFE ---
-
- if ( Source.Source == xIfacRes )
- {
- // --- SAFE ---
- aGuard.reset();
- m_bListening = false;
- xResource = m_xResource;
- xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
- m_xResource.clear();
- aGuard.clear();
- // --- SAFE ---
-
- if ( xListener.is() )
- {
- try
- {
- xListener->disposing( Source );
- }
- catch ( RuntimeException& )
- {
- throw;
- }
- catch ( Exception& )
- {
- }
- }
- }
- else if ( Source.Source == xIfacList )
- {
- // --- SAFE ---
- aGuard.reset();
- m_bListening = false;
- xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
- xResource = m_xResource;
- m_xResource.clear();
- m_xListener.clear();
- aGuard.clear();
- // --- SAFE ---
-
- // Remove ourself as listener from resource resolver
- Reference< util::XModifyBroadcaster > xModifyBroadcaster( xResource, UNO_QUERY );
- Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- if ( xModifyBroadcaster.is() )
- {
- try
- {
- xModifyBroadcaster->removeModifyListener( xThis );
- }
- catch ( RuntimeException& )
- {
- throw;
- }
- catch ( Exception& )
- {
- }
- }
- }
-}
-
// ============================================================================
// = class UnoDialogControl
// ============================================================================
UnoDialogControl::UnoDialogControl() :
maTopWindowListeners( *this ),
- mbWindowListener(false),
- mbSizeModified(false),
- mbPosModified(false)
+ mbWindowListener(false)
{
maComponentInfos.nWidth = 300;
maComponentInfos.nHeight = 450;
- mxListener = new ResourceListener( Reference< util::XModifyListener >(
- static_cast< OWeakObject* >( this ), UNO_QUERY ));
+ }
+
+UnoDialogControl::~UnoDialogControl()
+{
}
::rtl::OUString UnoDialogControl::GetComponentServiceName()
@@ -1355,120 +179,20 @@ UnoDialogControl::UnoDialogControl() :
// XInterface
Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException)
{
- Any aRet( UnoDialogControl_IBase::queryInterface( rType ) );
- return (aRet.hasValue() ? aRet : UnoControlContainer::queryAggregation( rType ));
-}
-
-// XTypeProvider
-IMPL_IMPLEMENTATION_ID( UnoDialogControl )
-Sequence< Type > UnoDialogControl::getTypes() throw(RuntimeException)
-{
- return ::comphelper::concatSequences(
- UnoDialogControl_IBase::getTypes(),
- UnoControlContainer::getTypes()
- );
-}
-
-void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
-{
- Reference< XPropertySet > xP( rxModel, UNO_QUERY );
-
- ::rtl::OUString aDefCtrl;
- xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
-
- // Add our own resource resolver to a newly created control
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
-
- Any aAny;
- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
-
- aAny <<= xStringResourceResolver;
- xP->setPropertyValue( aPropName, aAny );
-
- Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- Reference < XControl > xCtrl( xMSF->createInstance( aDefCtrl ), UNO_QUERY );
-
- DBG_ASSERT( xCtrl.is(), "UnoDialogControl::ImplInsertControl: could not create the control!" );
- if ( xCtrl.is() )
- {
- xCtrl->setModel( rxModel );
- addControl( rName, xCtrl );
- // will implicitly call addingControl, where we can add the PropertiesChangeListener to the model
- // (which we formerly did herein)
- // 08.01.2001 - 96008 - fs@openoffice.org
-
- ImplSetPosSize( xCtrl );
- }
-}
-
-void UnoDialogControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
-{
- Sequence< Reference< XControl > > aControls = getControls();
- Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
- if ( xCtrl.is() )
- removeControl( xCtrl );
-}
-
-void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
-{
- Reference< XPropertySet > xP( rxCtrl->getModel(), UNO_QUERY );
-
- sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) ) >>= nX;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) ) >>= nY;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
-
- // Currentley we are simply using MAP_APPFONT
- OutputDevice*pOutDev = Application::GetDefaultDevice();
- DBG_ASSERT( pOutDev, "Missing Default Device!" );
- if ( pOutDev )
- {
- ::Size aTmp( nX, nY );
- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
- nX = aTmp.Width();
- nY = aTmp.Height();
- aTmp = ::Size( nWidth, nHeight );
- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
- nWidth = aTmp.Width();
- nHeight = aTmp.Height();
- }
- else
- {
- Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer( sal_True );
- Reference< XDevice > xD( xPeer, UNO_QUERY );
-
- SimpleFontMetric aFM;
- FontDescriptor aFD;
- Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
- aVal >>= aFD;
- if ( aFD.StyleName.getLength() )
- {
- Reference< XFont > xFont = xD->getFont( aFD );
- aFM = xFont->getFontMetric();
- }
- else
- {
- Reference< XGraphics > xG = xD->createGraphics();
- aFM = xG->getFontMetric();
- }
-
- sal_Int16 nH = aFM.Ascent + aFM.Descent;
- sal_Int16 nW = nH/2; // calculate avarage width?!
-
- nX *= nW;
- nX /= 4;
- nWidth *= nW;
- nWidth /= 4;
- nY *= nH;
- nY /= 8;
- nHeight *= nH;
- nHeight /= 8;
- }
- Reference < XWindow > xW( rxCtrl, UNO_QUERY );
- xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
-}
+ uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XTopWindow*, this ) );
+ if ( !aRet.hasValue() )
+ aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XDialog*, this ) );
+ if ( !aRet.hasValue() )
+ aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XWindowListener*, this ) );
+ return (aRet.hasValue() ? aRet : ControlContainerBase::queryAggregation( rType ));
+}
+//lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoDialogControl)
+ getCppuType( ( uno::Reference< awt::XTopWindow>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XDialog>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XWindowListener>* ) NULL ),
+ ControlContainerBase::getTypes()
+IMPL_XTYPEPROVIDER_END
void UnoDialogControl::dispose() throw(RuntimeException)
{
@@ -1477,139 +201,25 @@ void UnoDialogControl::dispose() throw(RuntimeException)
EventObject aEvt;
aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
maTopWindowListeners.disposeAndClear( aEvt );
-
- // Notify our listener helper about dispose
- // --- SAFE ---
- ::osl::ResettableGuard< ::osl::Mutex > aGuard( GetMutex() );
- Reference< XEventListener > xListener( mxListener, UNO_QUERY );
- mxListener.clear();
- aGuard.clear();
- // --- SAFE ---
-
- if ( xListener.is() )
- xListener->disposing( aEvt );
-
- UnoControlContainer::dispose();
+ ControlContainerBase::dispose();
}
void SAL_CALL UnoDialogControl::disposing(
const EventObject& Source )
throw(RuntimeException)
{
- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
-
- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
- Reference< XInterface > xIfac( xStringResourceResolver, UNO_QUERY );
-
- if ( Source.Source == xIfac )
- {
- Any aAny;
-
- // Reset resource resolver reference
- ImplSetPropertyValue( aPropName, aAny, sal_True );
- ImplUpdateResourceResolver();
- }
- else
- {
- UnoControlContainer::disposing( Source );
- }
+ ControlContainerBase::disposing( Source );
}
sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
{
+ // #Can we move all the Resource stuff to the ControlContainerBase ?
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- // destroy the old tab controller, if existent
- if ( mxTabController.is() )
- {
- mxTabController->setModel( NULL ); // just to be sure, should not be necessary
- removeTabController( mxTabController );
- ::comphelper::disposeComponent( mxTabController ); // just to be sure, should not be necessary
- mxTabController.clear();
- }
-
- if ( getModel().is() )
- {
- Sequence< Reference< XControl > > aControls = getControls();
- const Reference< XControl >* pCtrls = aControls.getConstArray();
- const Reference< XControl >* pCtrlsEnd = pCtrls + aControls.getLength();
-
- for ( ; pCtrls < pCtrlsEnd; ++pCtrls )
- removeControl( *pCtrls );
- // will implicitly call removingControl, which will remove the PropertyChangeListener
- // (which we formerly did herein)
- // 08.01.2001 - 96008 - fs@openoffice.org
-
- Reference< XContainer > xC( getModel(), UNO_QUERY );
- if ( xC.is() )
- xC->removeContainerListener( this );
-
- Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
- if ( xChangeNotifier.is() )
- xChangeNotifier->removeChangesListener( this );
- }
-
- sal_Bool bRet = UnoControl::setModel( rxModel );
-
- if ( getModel().is() )
- {
- Reference< XNameAccess > xNA( getModel(), UNO_QUERY );
- if ( xNA.is() )
- {
- Sequence< ::rtl::OUString > aNames = xNA->getElementNames();
- const ::rtl::OUString* pNames = aNames.getConstArray();
- sal_uInt32 nCtrls = aNames.getLength();
-
- Reference< XControlModel > xCtrlModel;
- for( sal_uInt32 n = 0; n < nCtrls; ++n, ++pNames )
- {
- xNA->getByName( *pNames ) >>= xCtrlModel;
- ImplInsertControl( xCtrlModel, *pNames );
- }
- }
-
- Reference< XContainer > xC( getModel(), UNO_QUERY );
- if ( xC.is() )
- xC->addContainerListener( this );
-
- Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
- if ( xChangeNotifier.is() )
- xChangeNotifier->addChangesListener( this );
- }
-
- Reference< XTabControllerModel > xTabbing( getModel(), UNO_QUERY );
- if ( xTabbing.is() )
- {
- mxTabController = new StdTabController;
- mxTabController->setModel( xTabbing );
- addTabController( mxTabController );
- }
+ sal_Bool bRet = ControlContainerBase::setModel( rxModel );
ImplStartListingForResourceEvents();
-
return bRet;
}
-void UnoDialogControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- UnoControl::setDesignMode( bOn );
-
- Sequence< Reference< XControl > > xCtrls = getControls();
- sal_Int32 nControls = xCtrls.getLength();
- Reference< XControl >* pControls = xCtrls.getArray();
- for ( sal_Int32 n = 0; n < nControls; n++ )
- pControls[n]->setDesignMode( bOn );
-
- // #109067# in design mode the tab controller is not notified about
- // tab index changes, therefore the tab order must be activated
- // when switching from design mode to live mode
- if ( mxTabController.is() && !bOn )
- mxTabController->activateTabOrder();
-}
-
void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
{
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
@@ -1657,48 +267,11 @@ void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDes
getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
ImplGetPropertyValue( PROPERTY_IMAGEURL ));
- xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
+ xGraphic = ControlContainerBase::Impl_getGraphicFromURL_nothrow( absoluteUrl );
ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
}
}
-void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XControlModel > xModel;
- ::rtl::OUString aName;
-
- Event.Accessor >>= aName;
- Event.Element >>= xModel;
- ImplInsertControl( xModel, aName );
-}
-
-void UnoDialogControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XControlModel > xModel;
- Event.Element >>= xModel;
- if ( xModel.is() )
- ImplRemoveControl( xModel );
-}
-
-void UnoDialogControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XControlModel > xModel;
- Event.ReplacedElement >>= xModel;
- if ( xModel.is() )
- ImplRemoveControl( xModel );
-
- ::rtl::OUString aName;
- Event.Accessor >>= aName;
- Event.Element >>= xModel;
- ImplInsertControl( xModel, aName );
-}
-
void UnoDialogControl::addTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException)
{
maTopWindowListeners.addInterface( rxListener );
@@ -1752,13 +325,11 @@ void UnoDialogControl::setMenuBar( const Reference< XMenuBar >& rxMenuBar ) thro
xTW->setMenuBar( mxMenuBar );
}
}
-
static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
{
::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
return aTmp;
}
-
// ::com::sun::star::awt::XWindowListener
void SAL_CALL UnoDialogControl::windowResized( const ::com::sun::star::awt::WindowEvent& e )
throw (::com::sun::star::uno::RuntimeException)
@@ -1837,166 +408,6 @@ throw (::com::sun::star::uno::RuntimeException)
(void)e;
}
-// XPropertiesChangeListener
-void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
-{
- if( !isDesignMode() && !mbCreatingCompatiblePeer )
- {
- ::rtl::OUString s1( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
- ::rtl::OUString s2( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
- ::rtl::OUString s3( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
- ::rtl::OUString s4( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
-
- sal_Int32 nLen = rEvents.getLength();
- for( sal_Int32 i = 0; i < nLen; i++ )
- {
- const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
- Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
- sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
- if ( ( rEvt.PropertyName == s1 ) ||
- ( rEvt.PropertyName == s2 ) ||
- ( rEvt.PropertyName == s3 ) ||
- ( rEvt.PropertyName == s4 ) )
- {
- if ( bOwnModel )
- {
- if ( !mbPosModified && !mbSizeModified )
- {
- // Don't set new pos/size if we get new values from window listener
- Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
- ImplSetPosSize( xThis );
- }
- }
- else
- {
- Sequence<Reference<XControl> > aControlSequence(getControls());
- Reference<XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
- ImplSetPosSize( aControlRef );
- }
- break;
- }
- else if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ResourceResolver", 16 ))
- {
- ImplStartListingForResourceEvents();
- }
- }
- }
-
- sal_Int32 nLen = rEvents.getLength();
- for( sal_Int32 i = 0; i < nLen; i++ )
- {
- const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
- Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
- sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
- if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
- {
- ::rtl::OUString aImageURL;
- Reference< graphic::XGraphic > xGraphic;
- if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
- ( aImageURL.getLength() > 0 ))
- {
- ::rtl::OUString absoluteUrl =
- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
- ImplGetPropertyValue( PROPERTY_IMAGEURL ));
-
- xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
- }
-
- ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
- break;
- }
- }
-
- UnoControlContainer::ImplModelPropertiesChanged( rEvents );
-}
-
-void UnoDialogControl::ImplStartListingForResourceEvents()
-{
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
-
- ImplGetPropertyValue( PROPERTY_RESOURCERESOLVER ) >>= xStringResourceResolver;
-
- // Add our helper as listener to retrieve notifications about changes
- Reference< util::XModifyListener > rListener( mxListener );
- ResourceListener* pResourceListener = static_cast< ResourceListener* >( rListener.get() );
-
- // resource listener will stop listening if resolver reference is empty
- if ( pResourceListener )
- pResourceListener->startListening( xStringResourceResolver );
- ImplUpdateResourceResolver();
-}
-
-void UnoDialogControl::ImplUpdateResourceResolver()
-{
- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
-
- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
- if ( !xStringResourceResolver.is() )
- return;
-
- Any xNewStringResourceResolver; xNewStringResourceResolver <<= xStringResourceResolver;
-
- Sequence< rtl::OUString > aPropNames(1);
- aPropNames[0] = aPropName;
-
- const Sequence< Reference< awt::XControl > > aSeq = getControls();
- for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
- {
- Reference< XControl > xControl( aSeq[i] );
- Reference< XPropertySet > xPropertySet;
-
- if ( xControl.is() )
- xPropertySet = Reference< XPropertySet >( xControl->getModel(), UNO_QUERY );
-
- if ( !xPropertySet.is() )
- continue;
-
- try
- {
- Reference< resource::XStringResourceResolver > xCurrStringResourceResolver;
- Any aOldValue = xPropertySet->getPropertyValue( aPropName );
- if ( ( aOldValue >>= xCurrStringResourceResolver )
- && ( xStringResourceResolver == xCurrStringResourceResolver )
- )
- {
- Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
- Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
- xMultiPropSet->firePropertiesChangeEvent( aPropNames, xListener );
- }
- else
- xPropertySet->setPropertyValue( aPropName, xNewStringResourceResolver );
- }
- /*catch ( NoSuchElementException& )*/ // that's nonsense, this is never thrown above ...
- catch ( const Exception& )
- {
- }
- }
-
- // propagate resource resolver changes to language dependent props of the dialog
- Reference< XPropertySet > xPropertySet( getModel(), UNO_QUERY );
- if ( xPropertySet.is() )
- {
- Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
- Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
- xMultiPropSet->firePropertiesChangeEvent( lcl_getLanguageDependentProperties(), xListener );
- }
-}
-
-void SAL_CALL UnoDialogControl::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
-{
- Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
- if ( xPeerDialog.is() )
- xPeerDialog->endDialog( i_result );
-}
-
-void SAL_CALL UnoDialogControl::setHelpId( const rtl::OUString& i_id ) throw (RuntimeException)
-{
- Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
- if ( xPeerDialog.is() )
- xPeerDialog->setHelpId( i_id );
-}
-
void UnoDialogControl::setTitle( const ::rtl::OUString& Title ) throw(RuntimeException)
{
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
@@ -2042,53 +453,6 @@ void UnoDialogControl::endExecute() throw(RuntimeException)
}
}
-void UnoDialogControl::addingControl( const Reference< XControl >& _rxControl )
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- UnoControlContainer::addingControl( _rxControl );
-
- if ( _rxControl.is() )
- {
- Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
- if ( xProps.is() )
- {
- Sequence< ::rtl::OUString > aNames( 4 );
- ::rtl::OUString* pNames = aNames.getArray();
- *pNames++ = ::rtl::OUString::createFromAscii( "PositionX" );
- *pNames++ = ::rtl::OUString::createFromAscii( "PositionY" );
- *pNames++ = ::rtl::OUString::createFromAscii( "Width" );
- *pNames++ = ::rtl::OUString::createFromAscii( "Height" );
-
- xProps->addPropertiesChangeListener( aNames, this );
- }
- }
-}
-
-void UnoDialogControl::removingControl( const Reference< XControl >& _rxControl )
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- UnoControlContainer::removingControl( _rxControl );
-
- if ( _rxControl.is() )
- {
- Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
- if ( xProps.is() )
- xProps->removePropertiesChangeListener( this );
- }
-
-}
-
-void SAL_CALL UnoDialogControl::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- // a tab controller model may have changed
-
- // #109067# in design mode don't notify the tab controller
- // about tab index changes
- if ( mxTabController.is() && !mbDesignMode )
- mxTabController->activateTabOrder();
-}
-
// XModifyListener
void SAL_CALL UnoDialogControl::modified(
const lang::EventObject& /*rEvent*/ )
@@ -2097,35 +461,30 @@ throw (RuntimeException)
ImplUpdateResourceResolver();
}
-// ----------------------------------------------------
-// Helper Method to convert relative url to physical location
-// ----------------------------------------------------
-
-::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
+void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
{
- ::rtl::OUString baseLocation;
- ::rtl::OUString url;
-
- rbase >>= baseLocation;
- rUrl >>= url;
-
- ::rtl::OUString absoluteURL( url );
- if ( url.getLength() > 0 )
+ sal_Int32 nLen = rEvents.getLength();
+ for( sal_Int32 i = 0; i < nLen; i++ )
{
- INetURLObject urlObj(baseLocation);
- urlObj.removeSegment();
- baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
-
- const INetURLObject protocolCheck( url );
- const INetProtocol protocol = protocolCheck.GetProtocol();
- if ( protocol == INET_PROT_NOT_VALID )
+ const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
+ Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
+ sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
+ if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
{
- ::rtl::OUString testAbsoluteURL;
- if ( ::osl::FileBase::E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) )
- absoluteURL = testAbsoluteURL;
+ ::rtl::OUString aImageURL;
+ Reference< graphic::XGraphic > xGraphic;
+ if (( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ) ) >>= aImageURL ) &&
+ ( aImageURL.getLength() > 0 ))
+ {
+ ::rtl::OUString absoluteUrl =
+ getPhysicalLocation( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL )),
+ uno::makeAny(aImageURL));
+
+ xGraphic = Impl_getGraphicFromURL_nothrow( absoluteUrl );
+ }
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC), uno::makeAny( xGraphic ), sal_True );
+ break;
}
}
-
- return absoluteURL;
+ ControlContainerBase::ImplModelPropertiesChanged(rEvents);
}
-
diff --git a/toolkit/source/controls/spinningprogress.cxx b/toolkit/source/controls/spinningprogress.cxx
new file mode 100755
index 000000000000..d4b89d5123ec
--- /dev/null
+++ b/toolkit/source/controls/spinningprogress.cxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_toolkit.hxx"
+
+#include "toolkit/controls/spinningprogress.hxx"
+#include "toolkit/helper/servicenames.hxx"
+#include "toolkit/helper/unopropertyarrayhelper.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <rtl/ustrbuf.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/throbber.hxx>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= SpinningProgressControlModel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ SpinningProgressControlModel::SpinningProgressControlModel()
+ {
+ // default image sets
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ try
+ {
+ Throbber::ImageSet aImageSets[] =
+ {
+ Throbber::IMAGES_16_PX, Throbber::IMAGES_32_PX, Throbber::IMAGES_64_PX
+ };
+ for ( size_t i=0; i < sizeof( aImageSets ) / sizeof( aImageSets[0] ); ++i )
+ {
+ const ::std::vector< ::rtl::OUString > aDefaultURLs( Throbber::getDefaultImageURLs( aImageSets[i] ) );
+ const Sequence< ::rtl::OUString > aImageURLs( &aDefaultURLs[0], aDefaultURLs.size() );
+ insertImageSet( i, aImageURLs );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SpinningProgressControlModel::SpinningProgressControlModel( const SpinningProgressControlModel& i_copySource )
+ :SpinningProgressControlModel_Base( i_copySource )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SpinningProgressControlModel::~SpinningProgressControlModel()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ UnoControlModel* SpinningProgressControlModel::Clone() const
+ {
+ return new SpinningProgressControlModel( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XPropertySetInfo > SAL_CALL SpinningProgressControlModel::getPropertySetInfo( ) throw(RuntimeException)
+ {
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL SpinningProgressControlModel::getServiceName() throw(RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL SpinningProgressControlModel::getImplementationName( ) throw(RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( "org.openoffice.comp.toolkit.SpinningProgressControlModel" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL SpinningProgressControlModel::getSupportedServiceNames() throw(RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServiceNames(3);
+ aServiceNames[0] = ::rtl::OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
+ aServiceNames[1] = ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
+ aServiceNames[2] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.UnoControlModel" );
+ return aServiceNames;
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
diff --git a/toolkit/source/controls/tabpagecontainer.cxx b/toolkit/source/controls/tabpagecontainer.cxx
new file mode 100644
index 000000000000..b7e381ae27c7
--- /dev/null
+++ b/toolkit/source/controls/tabpagecontainer.cxx
@@ -0,0 +1,301 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/controls/tabpagecontainer.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <tools/diagnose_ex.h>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::view;
+
+#define WRONG_TYPE_EXCEPTION "Type must be ::com::sun::star::awt::tab::XTabPageModel!"
+// ----------------------------------------------------
+// class UnoControlTabPageContainerModel
+// ----------------------------------------------------
+UnoControlTabPageContainerModel::UnoControlTabPageContainerModel() : maContainerListeners( *this )
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_TEXT );
+}
+
+::rtl::OUString UnoControlTabPageContainerModel::getServiceName() throw(RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageContainerModel );
+}
+
+uno::Any UnoControlTabPageContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ switch(nPropId)
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageContainer ) );
+ case BASEPROPERTY_BORDER:
+ return uno::makeAny((sal_Int16) 0); // No Border
+ default:
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+}
+
+::cppu::IPropertyArrayHelper& UnoControlTabPageContainerModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlTabPageContainerModel::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+void SAL_CALL UnoControlTabPageContainerModel::insertByIndex( ::sal_Int32 nIndex, const com::sun::star::uno::Any& aElement) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ uno::Reference < ::awt::tab::XTabPageModel > xTabPageModel;
+ if(aElement >>= xTabPageModel)
+ {
+ if ( sal_Int32( m_aTabPageVector.size()) ==nIndex )
+ m_aTabPageVector.push_back( xTabPageModel );
+ else if ( sal_Int32( m_aTabPageVector.size()) > nIndex )
+ {
+ std::vector< uno::Reference< ::awt::tab::XTabPageModel > >::iterator aIter = m_aTabPageVector.begin();
+ aIter += nIndex;
+ m_aTabPageVector.insert( aIter, xTabPageModel );
+ }
+ else
+ throw IndexOutOfBoundsException( ::rtl::OUString(), (OWeakObject *)this );
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= aElement;
+ aEvent.Accessor <<= ::rtl::OUString::valueOf(nIndex);
+ maContainerListeners.elementInserted( aEvent );
+ }
+ else
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( WRONG_TYPE_EXCEPTION )),
+ (OWeakObject *)this, 2 );
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL UnoControlTabPageContainerModel::removeByIndex( ::sal_Int32 /*Index*/ ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+// XIndexReplace
+void SAL_CALL UnoControlTabPageContainerModel::replaceByIndex( ::sal_Int32 /*Index*/, const uno::Any& /*Element*/ ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+// -----------------------------------------------------------------------------
+// XIndexAccess
+::sal_Int32 SAL_CALL UnoControlTabPageContainerModel::getCount( ) throw (uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return sal_Int32( m_aTabPageVector.size());
+}
+// -----------------------------------------------------------------------------
+uno::Any SAL_CALL UnoControlTabPageContainerModel::getByIndex( ::sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ if ( nIndex < 0 || nIndex > sal_Int32(m_aTabPageVector.size()) )
+ throw lang::IndexOutOfBoundsException();
+ return uno::makeAny(m_aTabPageVector[nIndex]);
+}
+// -----------------------------------------------------------------------------
+// XElementAccess
+uno::Type SAL_CALL UnoControlTabPageContainerModel::getElementType( ) throw (uno::RuntimeException)
+{
+ return ::getCppuType(static_cast< Reference< com::sun::star::awt::XControlModel>* >(NULL));
+}
+// -----------------------------------------------------------------------------
+::sal_Bool SAL_CALL UnoControlTabPageContainerModel::hasElements( ) throw (uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return !m_aTabPageVector.empty();
+}
+// XContainer
+void UnoControlTabPageContainerModel::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.addInterface( l );
+}
+
+void UnoControlTabPageContainerModel::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.removeInterface( l );
+}
+
+// ----------------------------------------------------
+// class UnoControlTabPageContainer
+// ----------------------------------------------------
+UnoControlTabPageContainer::UnoControlTabPageContainer():
+ m_aTabPageListeners( *this )
+{
+}
+
+OUString UnoControlTabPageContainer::GetComponentServiceName()
+{
+ return OUString::createFromAscii( "TabPageContainer" );
+}
+
+void SAL_CALL UnoControlTabPageContainer::dispose( ) throw(RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ m_aTabPageListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+void UnoControlTabPageContainer::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoControlBase::createPeer( rxToolkit, rParentPeer );
+
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ if ( m_aTabPageListeners.getLength() )
+ xTPContainer->addTabPageListener(&m_aTabPageListeners);
+}
+
+// -------------------------------------------------------------------
+// XTabPageContainer
+
+::sal_Int16 SAL_CALL UnoControlTabPageContainer::getActiveTabPageID() throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->getActiveTabPageID();
+}
+void SAL_CALL UnoControlTabPageContainer::setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ xTPContainer->setActiveTabPageID(_activetabpageid);
+}
+::sal_Int32 SAL_CALL UnoControlTabPageContainer::getTabPageCount( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->getTabPageCount();
+}
+::sal_Bool SAL_CALL UnoControlTabPageContainer::isTabPageActive( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->isTabPageActive(tabPageIndex);
+}
+Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL UnoControlTabPageContainer::getTabPage( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->getTabPage(tabPageIndex);
+}
+Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL UnoControlTabPageContainer::getTabPageByID( ::sal_Int16 tabPageID ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->getTabPageByID(tabPageID);
+}
+void SAL_CALL UnoControlTabPageContainer::addTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
+{
+ m_aTabPageListeners.addInterface( listener );
+ if( getPeer().is() && m_aTabPageListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::tab::XTabPageContainer > xTabPageContainer( getPeer(), uno::UNO_QUERY );
+ xTabPageContainer->addTabPageListener( &m_aTabPageListeners );
+ }
+}
+void SAL_CALL UnoControlTabPageContainer::removeTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
+{
+ if( getPeer().is() && m_aTabPageListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::tab::XTabPageContainer > xTabPageContainer( getPeer(), uno::UNO_QUERY );
+ xTabPageContainer->addTabPageListener( &m_aTabPageListeners );
+ }
+ m_aTabPageListeners.removeInterface( listener );
+}
+
+void UnoControlTabPageContainer::updateFromModel()
+{
+ UnoControlTabPageContainer_Base::updateFromModel();
+ Reference< XContainerListener > xContainerListener( getPeer(), UNO_QUERY );
+ ENSURE_OR_RETURN_VOID( xContainerListener.is(), "UnoListBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
+
+ ContainerEvent aEvent;
+ aEvent.Source = getModel();
+ Sequence< Reference< XControl > > aControls = getControls();
+ const Reference< XControl >* pCtrls = aControls.getConstArray();
+ const Reference< XControl >* pCtrlsEnd = pCtrls + aControls.getLength();
+
+ for ( ; pCtrls < pCtrlsEnd; ++pCtrls )
+ {
+ aEvent.Element <<= *pCtrls;
+ xContainerListener->elementInserted( aEvent );
+ }
+}
+void SAL_CALL UnoControlTabPageContainer::addControl( const ::rtl::OUString& Name, const Reference< ::com::sun::star::awt::XControl >& Control ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ControlContainerBase::addControl(Name,Control);
+ Reference< XContainerListener > xContainerListener( getPeer(), UNO_QUERY );
+ ContainerEvent aEvent;
+ aEvent.Source = getModel();
+ aEvent.Element <<= Control;
+ xContainerListener->elementInserted( aEvent );
+}
+
+Reference< XInterface > SAL_CALL UnoControlTabPageContainer_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new UnoControlTabPageContainer );
+}
+
+Reference< XInterface > SAL_CALL UnoControlTabPageContainerModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlTabPageContainerModel>() );
+}
diff --git a/toolkit/source/controls/tabpagemodel.cxx b/toolkit/source/controls/tabpagemodel.cxx
new file mode 100644
index 000000000000..4afd46724cab
--- /dev/null
+++ b/toolkit/source/controls/tabpagemodel.cxx
@@ -0,0 +1,404 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/wall.hxx>
+#include <vos/mutex.hxx>
+#include <toolkit/controls/tabpagemodel.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/controls/stdtabcontroller.hxx>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/UnoControlDialogModelProvider.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <tools/list.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/sequence.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/image.hxx>
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+
+#include <map>
+#include <algorithm>
+#include <functional>
+#include "tools/urlobj.hxx"
+#include "osl/file.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+
+////HELPER
+::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
+
+// ----------------------------------------------------
+// class TabPageModel
+// ----------------------------------------------------
+
+//TabPageModel::TabPageModel()
+//{
+//}
+//TabPageModel::TabPageModel( uno::Reference< uno::XComponentContext > const & xCompContext)
+//{
+// (void) xCompContext;
+//}
+//
+//TabPageModel::~TabPageModel()
+//{
+//}
+//
+//////----- XInitialization -------------------------------------------------------------------
+//void SAL_CALL TabPageModel::initialize (const Sequence<Any>& rArguments)
+//{
+// sal_Int16 nPageId;
+// if ( rArguments.getLength() == 1 )
+// {
+// if ( !( rArguments[ 0 ] >>= nPageId ))
+// throw lang::IllegalArgumentException();
+// m_nTabPageId = nPageId;
+// }
+// else
+// m_nTabPageId = -1;
+//}
+//::sal_Int16 SAL_CALL TabPageModel::getTabPageID() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_nTabPageId;
+//}
+//::sal_Bool SAL_CALL TabPageModel::getEnabled() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_bEnabled;
+//}
+//void SAL_CALL TabPageModel::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException)
+//{
+// m_bEnabled = _enabled;
+//}
+//::rtl::OUString SAL_CALL TabPageModel::getTitle() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_sTitle;
+//}
+//void SAL_CALL TabPageModel::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException)
+//{
+// m_sTitle = _title;
+//}
+//::rtl::OUString SAL_CALL TabPageModel::getImageURL() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_sImageURL;
+//}
+//void SAL_CALL TabPageModel::setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException)
+//{
+// m_sImageURL = _imageurl;
+//}
+//::rtl::OUString SAL_CALL TabPageModel::getTooltip() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_sTooltip;
+//}
+//void SAL_CALL TabPageModel::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException)
+//{
+// m_sTooltip = _tooltip;
+//}
+
+// ----------------------------------------------------
+// class UnoControlTabPageModel
+// ----------------------------------------------------
+UnoControlTabPageModel::UnoControlTabPageModel(Reference< XComponentContext >const & i_xCompContext) : m_xCompContext(i_xCompContext)
+{
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_TITLE );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+}
+
+::rtl::OUString UnoControlTabPageModel::getServiceName( ) throw(RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageModel );
+}
+
+Any UnoControlTabPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ Any aAny;
+
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPage );
+ break;
+ default:
+ aAny = UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+
+ return aAny;
+}
+
+::cppu::IPropertyArrayHelper& UnoControlTabPageModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlTabPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+////----- XInitialization -------------------------------------------------------------------
+void SAL_CALL UnoControlTabPageModel::initialize (const Sequence<Any>& rArguments)
+ throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nPageId = -1;
+ if ( rArguments.getLength() == 1 )
+ {
+ if ( !( rArguments[ 0 ] >>= nPageId ))
+ throw lang::IllegalArgumentException();
+ m_nTabPageId = nPageId;
+ }
+ else if ( rArguments.getLength() == 2 )
+ {
+ if ( !( rArguments[ 0 ] >>= nPageId ))
+ throw lang::IllegalArgumentException();
+ m_nTabPageId = nPageId;
+ ::rtl::OUString sURL;
+ if ( !( rArguments[ 1 ] >>= sURL ))
+ throw lang::IllegalArgumentException();
+ Reference<container::XNameContainer > xDialogModel = awt::UnoControlDialogModelProvider::create(m_xCompContext,sURL);
+ if ( xDialogModel.is() )
+ {
+ Sequence< ::rtl::OUString> aNames = xDialogModel->getElementNames();
+ const ::rtl::OUString* pIter = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aNames.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ try
+ {
+ Any aElement(xDialogModel->getByName(*pIter));
+ xDialogModel->removeByName(*pIter);
+ insertByName(*pIter,aElement);
+ }
+ catch(const Exception& ex)
+ {
+ (void)ex;
+ }
+ }
+ Reference<XPropertySet> xDialogProp(xDialogModel,UNO_QUERY);
+ if ( xDialogProp.is() )
+ {
+ static const ::rtl::OUString s_sResourceResolver(RTL_CONSTASCII_USTRINGPARAM("ResourceResolver"));
+ Reference<XPropertySet> xThis(*this,UNO_QUERY);
+ xThis->setPropertyValue(s_sResourceResolver,xDialogProp->getPropertyValue(s_sResourceResolver));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_TITLE),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_TITLE)));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_IMAGEURL),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_IMAGEURL)));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_HELPTEXT),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_HELPTEXT)));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_ENABLED),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_ENABLED)));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_HELPURL),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_HELPURL)));
+ }
+ }
+ }
+ else
+ m_nTabPageId = -1;
+}
+//===== Service ===============================================================
+Reference< XInterface > SAL_CALL UnoControlTabPageModel_CreateInstance( const Reference< XMultiServiceFactory >& xServiceFactory)
+{
+ Reference < ::com::sun::star::beans::XPropertySet > xPropertySet (xServiceFactory, UNO_QUERY);
+ Any any = xPropertySet->getPropertyValue(::rtl::OUString::createFromAscii("DefaultContext"));
+ Reference < XComponentContext > xCompCtx;
+ any >>= xCompCtx;
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlTabPageModel>(xCompCtx) );
+ //return Reference < XInterface > ( (::cppu::OWeakObject* ) new UnoControlTabPageModel(xCompCtx));
+}
+
+::rtl::OUString UnoControlTabPageModel_getImplementationName (void) throw(RuntimeException)
+{
+ return rtl::OUString::createFromAscii("com.sun.star.awt.tab.UnoControlTabPageModel");
+}
+
+Sequence<rtl::OUString> SAL_CALL UnoControlTabPageModel_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString::createFromAscii("com.sun.star.awt.tab.UnoControlTabPageModel"));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+//=============================================================================
+// = class UnoControlTabPage
+// ============================================================================
+
+UnoControlTabPage::UnoControlTabPage() :
+ m_bWindowListener(false)
+{
+ maComponentInfos.nWidth = 280;
+ maComponentInfos.nHeight = 400;
+}
+UnoControlTabPage::~UnoControlTabPage()
+{
+}
+
+::rtl::OUString UnoControlTabPage::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "TabPageModel" );
+}
+
+void UnoControlTabPage::dispose() throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
+ ControlContainerBase::dispose();
+}
+
+void SAL_CALL UnoControlTabPage::disposing( const EventObject& Source )throw(RuntimeException)
+{
+ ControlContainerBase::disposing( Source );
+}
+
+void UnoControlTabPage::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ImplUpdateResourceResolver();
+
+ UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+
+ Reference < tab::XTabPage > xTabPage( getPeer(), UNO_QUERY );
+ if ( xTabPage.is() )
+ {
+ if ( !m_bWindowListener )
+ {
+ Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY );
+ addWindowListener( xWL );
+ m_bWindowListener = true;
+ }
+ }
+}
+
+static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
+{
+ ::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
+ return aTmp;
+}
+// ::com::sun::star::awt::XWindowListener
+void SAL_CALL UnoControlTabPage::windowResized( const ::com::sun::star::awt::WindowEvent& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ OutputDevice*pOutDev = Application::GetDefaultDevice();
+ DBG_ASSERT( pOutDev, "Missing Default Device!" );
+ if ( pOutDev && !mbSizeModified )
+ {
+ // Currentley we are simply using MAP_APPFONT
+ ::Size aAppFontSize( e.Width, e.Height );
+
+ Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW );
+ Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY );
+ OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" );
+ if ( xDialogDevice.is() )
+ {
+ DeviceInfo aDeviceInfo( xDialogDevice->getInfo() );
+ aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
+ aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
+ }
+
+ aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize );
+
+ // Remember that changes have been done by listener. No need to
+ // update the position because of property change event.
+ mbSizeModified = true;
+ Sequence< rtl::OUString > aProps( 2 );
+ Sequence< Any > aValues( 2 );
+ // Properties in a sequence must be sorted!
+ aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ));
+ aProps[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ));
+ aValues[0] <<= aAppFontSize.Height();
+ aValues[1] <<= aAppFontSize.Width();
+
+ ImplSetPropertyValues( aProps, aValues, true );
+ mbSizeModified = false;
+ }
+}
+
+void SAL_CALL UnoControlTabPage::windowMoved( const ::com::sun::star::awt::WindowEvent& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ OutputDevice*pOutDev = Application::GetDefaultDevice();
+ DBG_ASSERT( pOutDev, "Missing Default Device!" );
+ if ( pOutDev && !mbPosModified )
+ {
+ // Currentley we are simply using MAP_APPFONT
+ Any aAny;
+ ::Size aTmp( e.X, e.Y );
+ aTmp = ImplMapPixelToAppFont( pOutDev, aTmp );
+
+ // Remember that changes have been done by listener. No need to
+ // update the position because of property change event.
+ mbPosModified = true;
+ Sequence< rtl::OUString > aProps( 2 );
+ Sequence< Any > aValues( 2 );
+ aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ));
+ aProps[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ));
+ aValues[0] <<= aTmp.Width();
+ aValues[1] <<= aTmp.Height();
+
+ ImplSetPropertyValues( aProps, aValues, true );
+ mbPosModified = false;
+ }
+}
+
+void SAL_CALL UnoControlTabPage::windowShown( const ::com::sun::star::lang::EventObject& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)e;
+}
+
+void SAL_CALL UnoControlTabPage::windowHidden( const ::com::sun::star::lang::EventObject& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)e;
+}
diff --git a/toolkit/source/controls/tksimpleanimation.cxx b/toolkit/source/controls/tksimpleanimation.cxx
index 3d89bf59af82..6ad33608f6ee 100644
--- a/toolkit/source/controls/tksimpleanimation.cxx
+++ b/toolkit/source/controls/tksimpleanimation.cxx
@@ -130,27 +130,6 @@ namespace toolkit
}
//--------------------------------------------------------------------
- uno::Any UnoSimpleAnimationControl::queryAggregation( const uno::Type & rType )
- throw( uno::RuntimeException )
- {
- uno::Any aRet = UnoControlBase::queryAggregation( rType );
- if ( !aRet.hasValue() )
- aRet = UnoSimpleAnimationControl_Base::queryInterface( rType );
- return aRet;
- }
-
- //--------------------------------------------------------------------
- IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoSimpleAnimationControl, UnoControlBase, UnoSimpleAnimationControl_Base )
-
- //--------------------------------------------------------------------
- void UnoSimpleAnimationControl::dispose() throw( uno::RuntimeException )
- {
- ::osl::ClearableMutexGuard aGuard( GetMutex() );
-
- UnoControl::dispose();
- }
-
- //--------------------------------------------------------------------
::rtl::OUString SAL_CALL UnoSimpleAnimationControl::getImplementationName()
throw( uno::RuntimeException )
{
@@ -161,26 +140,20 @@ namespace toolkit
uno::Sequence< ::rtl::OUString > SAL_CALL UnoSimpleAnimationControl::getSupportedServiceNames()
throw( uno::RuntimeException )
{
- uno::Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() );
+ uno::Sequence< ::rtl::OUString > aServices( UnoSimpleAnimationControl_Base::getSupportedServiceNames() );
aServices.realloc( aServices.getLength() + 1 );
aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControl );
return aServices;
}
//--------------------------------------------------------------------
- void UnoSimpleAnimationControl::createPeer( const uno::Reference< awt::XToolkit > &rxToolkit,
- const uno::Reference< awt::XWindowPeer > &rParentPeer )
- throw( uno::RuntimeException )
- {
- UnoControl::createPeer( rxToolkit, rParentPeer );
- }
-
- //--------------------------------------------------------------------
void SAL_CALL UnoSimpleAnimationControl::start() throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( GetMutex() );
-
- uno::Reference< XSimpleAnimation > xAnimation( getPeer(), uno::UNO_QUERY );
+ uno::Reference< XSimpleAnimation > xAnimation;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xAnimation.set( getPeer(), uno::UNO_QUERY );
+ }
if ( xAnimation.is() )
xAnimation->start();
}
@@ -188,9 +161,11 @@ namespace toolkit
//--------------------------------------------------------------------
void SAL_CALL UnoSimpleAnimationControl::stop() throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( GetMutex() );
-
- uno::Reference< XSimpleAnimation > xAnimation( getPeer(), uno::UNO_QUERY );
+ uno::Reference< XSimpleAnimation > xAnimation;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xAnimation.set( getPeer(), uno::UNO_QUERY );
+ }
if ( xAnimation.is() )
xAnimation->stop();
}
@@ -199,9 +174,11 @@ namespace toolkit
void SAL_CALL UnoSimpleAnimationControl::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& ImageList )
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( GetMutex() );
-
- uno::Reference< XSimpleAnimation > xAnimation( getPeer(), uno::UNO_QUERY );
+ uno::Reference< XSimpleAnimation > xAnimation;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xAnimation.set( getPeer(), uno::UNO_QUERY );
+ }
if ( xAnimation.is() )
xAnimation->setImageList( ImageList );
}
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx
index c3149a8cc869..3afe3a90f1ee 100644
--- a/toolkit/source/controls/unocontrolcontainer.cxx
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -808,6 +808,7 @@ void UnoControlContainer::createPeer( const uno::Reference< awt::XToolkit >& rxT
aCtrls.getArray()[n]->createPeer( rxToolkit, getPeer() );
uno::Reference< awt::XVclContainerPeer > xC( getPeer(), uno::UNO_QUERY );
+ OSL_ENSURE(xC.is(),"Peer isn't valid. Please check!");
xC->enableDialogControl( sal_True );
ImplActivateTabControllers();
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index 02577296e706..bdedfbf2e5e6 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -532,6 +532,8 @@ void UnoControlModel::dispose( ) throw(::com::sun::star::uno::RuntimeException)
aEvt.Source = (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this;
maDisposeListeners.disposeAndClear( aEvt );
+ BrdcstHelper.aLC.disposeAndClear( aEvt );
+
// let the property set helper notify our property listeners
OPropertySetHelper::disposing();
}
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index d3838a7421a4..87d46a592d17 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -1801,6 +1801,11 @@ struct UnoControlListBoxModel_Data
return aItems;
}
+ void copyItems( const UnoControlListBoxModel_Data& i_copySource )
+ {
+ m_aListItems = i_copySource.m_aListItems;
+ }
+
void setAllItems( const ::std::vector< ListItem >& i_rItems )
{
m_aListItems = i_rItems;
@@ -1852,6 +1857,7 @@ UnoControlListBoxModel::UnoControlListBoxModel( const UnoControlListBoxModel& i_
,m_pData( new UnoControlListBoxModel_Data( *this ) )
,m_aItemListListeners( GetMutex() )
{
+ m_pData->copyItems( *i_rSource.m_pData );
}
UnoControlListBoxModel::~UnoControlListBoxModel()
{
@@ -4356,3 +4362,4 @@ sal_Bool UnoFixedLineControl::isTransparent() throw(uno::RuntimeException)
{
return sal_True;
}
+
diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx
index 9b8df60521ae..ed2fe978b169 100644
--- a/toolkit/source/helper/listenermultiplexer.cxx
+++ b/toolkit/source/helper/listenermultiplexer.cxx
@@ -211,3 +211,9 @@ IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer, ::com::sun::s
// ----------------------------------------------------
IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener )
IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener, selectionChanged, ::com::sun::star::awt::grid::GridSelectionEvent )
+
+// ----------------------------------------------------
+// class SelectionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener, tabPageActivated, ::com::sun::star::awt::tab::TabPageActivatedEvent )
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index 3a83465a3218..1e90c0172e83 100644
--- a/toolkit/source/helper/property.cxx
+++ b/toolkit/source/helper/property.cxx
@@ -66,6 +66,7 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::awt::XDevice;
using ::com::sun::star::awt::FontDescriptor;
using ::com::sun::star::style::VerticalAlignment;
+using ::com::sun::star::graphic::XGraphic;
struct ImplPropertyInfo
{
@@ -181,7 +182,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_3 ( "FormatKey", FORMATKEY, sal_Int32, BOUND, MAYBEVOID, TRANSIENT ),
DECL_PROP_3 ( "FormatsSupplier", FORMATSSUPPLIER, Reference< ::com::sun::star::util::XNumberFormatsSupplier >, BOUND, MAYBEVOID, TRANSIENT ),
- DECL_PROP_2 ( "Graphic", GRAPHIC, Reference< ::com::sun::star::graphic::XGraphic >, BOUND, TRANSIENT ),
+ DECL_PROP_2 ( "Graphic", GRAPHIC, Reference< XGraphic >, BOUND, TRANSIENT ),
DECL_PROP_2 ( "HelpText", HELPTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ),
@@ -218,6 +219,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_2 ( "PushButtonType", PUSHBUTTONTYPE, sal_Int16, BOUND, MAYBEDEFAULT),
DECL_PROP_2 ( "ReadOnly", READONLY, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "Repeat", REPEAT, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "AutoRepeat", AUTO_REPEAT, sal_Bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "RepeatDelay", REPEAT_DELAY, sal_Int32, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "ScaleImage", SCALEIMAGE, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "ScaleMode", IMAGE_SCALE_MODE, sal_Int16, BOUND, MAYBEDEFAULT ),
diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
index 477032538af8..37f33c4168ff 100644
--- a/toolkit/source/helper/registerservices.cxx
+++ b/toolkit/source/helper/registerservices.cxx
@@ -51,8 +51,14 @@
#include "toolkit/controls/tkspinbutton.hxx"
#include <toolkit/controls/tksimpleanimation.hxx>
#include <toolkit/controls/tkthrobber.hxx>
+#include <toolkit/controls/animatedimages.hxx>
+#include <toolkit/controls/spinningprogress.hxx>
#include <toolkit/controls/dialogcontrol.hxx>
+#include <toolkit/controls/tabpagemodel.hxx>
+#include <toolkit/controls/tabpagecontainer.hxx>
#include "toolkit/dllapi.h"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
namespace toolkit
{
@@ -135,6 +141,14 @@ namespace toolkit
if ( pRet ) \
return pRet; \
+#define TRY_OOO_FACTORY( ImplName, ServiceName ) \
+ pRet = tryCreateFactory( sImplementationName, "org.openoffice.comp.toolkit." #ImplName, \
+ ServiceName, NULL, \
+ ImplName##_CreateInstance, xServiceFactory \
+ ); \
+ if ( pRet ) \
+ return pRet; \
+
using namespace toolkit;
IMPL_CREATEINSTANCE2( VCLXToolkit )
@@ -195,6 +209,13 @@ IMPL_CREATEINSTANCE( UnoSimpleAnimationControl )
IMPL_CREATEINSTANCE( UnoSimpleAnimationControlModel )
IMPL_CREATEINSTANCE( UnoThrobberControl )
IMPL_CREATEINSTANCE( UnoThrobberControlModel )
+IMPL_CREATEINSTANCE( UnoControlTabPage )
+//IMPL_CREATEINSTANCE( UnoControlTabPageModel )
+//IMPL_CREATEINSTANCE( UnoControlTabPageContainer )
+//IMPL_CREATEINSTANCE( UnoControlTabPageContainerModel )
+IMPL_CREATEINSTANCE( AnimatedImagesControl )
+IMPL_CREATEINSTANCE( AnimatedImagesControlModel )
+IMPL_CREATEINSTANCE( SpinningProgressControlModel )
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
@@ -204,6 +225,11 @@ extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridColumn_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlTabPageContainer_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlTabPageContainerModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+
+//extern sal_Bool SAL_CALL UnoControlTabPageModel_component_writeInfo(void * serviceManager, void * registryKey);
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlTabPageModel_CreateInstance (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern void * SAL_CALL comp_AsyncCallback_component_getFactory( const char * implName, void * serviceManager, void * registryKey );
@@ -288,19 +314,24 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
CHECKANDCREATEFACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl )
CHECKANDCREATEFACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel )
CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl )
+ TRY_OOO_FACTORY( AnimatedImagesControl, szServiceName_AnimatedImagesControl )
+ TRY_OOO_FACTORY( AnimatedImagesControlModel, szServiceName_AnimatedImagesControlModel )
+ TRY_OOO_FACTORY( SpinningProgressControlModel, szServiceName_SpinningProgressControlModel )
CHECKANDCREATEFACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
CHECKANDCREATEFACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
- CHECKANDCREATEFACTORY( GridControl, szServiceName_GridControl, NULL );
- CHECKANDCREATEFACTORY( GridControlModel, szServiceName_GridControlModel, NULL );
- CHECKANDCREATEFACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL );
- CHECKANDCREATEFACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL );
- CHECKANDCREATEFACTORY( GridColumn, szServiceName_GridColumn, NULL );
+ CHECKANDCREATEFACTORY( GridControl, szServiceName_GridControl, NULL )
+ CHECKANDCREATEFACTORY( GridControlModel, szServiceName_GridControlModel, NULL )
+ CHECKANDCREATEFACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL )
+ CHECKANDCREATEFACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL )
+ CHECKANDCREATEFACTORY( GridColumn, szServiceName_GridColumn, NULL )
+ CHECKANDCREATEFACTORY( UnoControlTabPageModel, szServiceName_UnoControlTabPageModel, NULL )
+ CHECKANDCREATEFACTORY( UnoControlTabPage, szServiceName_UnoControlTabPage, NULL )
+ CHECKANDCREATEFACTORY( UnoControlTabPageContainerModel, szServiceName_UnoControlTabPageContainerModel, NULL )
+ CHECKANDCREATEFACTORY( UnoControlTabPageContainer, szServiceName_UnoControlTabPageContainer, NULL )
if ( rtl_str_compare( sImplementationName, "com.sun.star.awt.comp.AsyncCallback" ) == 0 )
return comp_AsyncCallback_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
-
-
if( pRet == 0 )
pRet = comp_Layout_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
}
diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
index f57f52f13e57..383adb22b9de 100644
--- a/toolkit/source/helper/servicenames.cxx
+++ b/toolkit/source/helper/servicenames.cxx
@@ -92,6 +92,9 @@ const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.T
const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel";
const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoSimpleAnimationControlModel", szServiceName2_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoControlSimpleAnimationModel";
+const sal_Char __FAR_DATA szServiceName_AnimatedImagesControl[] = "com.sun.star.awt.AnimatedImagesControl";
+const sal_Char __FAR_DATA szServiceName_AnimatedImagesControlModel[] = "com.sun.star.awt.AnimatedImagesControlModel";
+const sal_Char __FAR_DATA szServiceName_SpinningProgressControlModel[] = "com.sun.star.awt.SpinningProgressControlModel";
const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoSimpleAnimationControl", szServiceName2_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoControlSimpleAnimation";
const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[] = "com.sun.star.awt.UnoThrobberControlModel", szServiceName2_UnoThrobberControlModel[] = "com.sun.star.awt.UnoControlThrobberModel";
const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl", szServiceName2_UnoThrobberControl[] = "com.sun.star.awt.UnoControlThrobber";
@@ -102,3 +105,8 @@ const sal_Char __FAR_DATA szServiceName_GridControlModel[] = "com.sun.star.awt.g
const sal_Char __FAR_DATA szServiceName_DefaultGridDataModel[] = "com.sun.star.awt.grid.DefaultGridDataModel";
const sal_Char __FAR_DATA szServiceName_DefaultGridColumnModel[] = "com.sun.star.awt.grid.DefaultGridColumnModel";
const sal_Char __FAR_DATA szServiceName_GridColumn[] = "com.sun.star.awt.grid.GridColumn";
+const sal_Char __FAR_DATA szServiceName_UnoControlTabPage[] = "com.sun.star.awt.tab.UnoControlTabPage";
+const sal_Char __FAR_DATA szServiceName_UnoControlTabPageModel[] = "com.sun.star.awt.tab.UnoControlTabPageModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainerModel[] = "com.sun.star.awt.tab.UnoControlTabPageContainerModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainer[] = "com.sun.star.awt.tab.UnoControlTabPageContainer";
+
diff --git a/toolkit/source/helper/throbberimpl.cxx b/toolkit/source/helper/throbberimpl.cxx
deleted file mode 100644
index 7a8e260ab4b8..000000000000
--- a/toolkit/source/helper/throbberimpl.cxx
+++ /dev/null
@@ -1,138 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-#include "precompiled_toolkit.hxx"
-#include <toolkit/helper/throbberimpl.hxx>
-
-#include <vcl/svapp.hxx>
-#include <vcl/fixed.hxx>
-
-//........................................................................
-namespace toolkit
-//........................................................................
-{
- using namespace ::com::sun::star;
-
- //--------------------------------------------------------------------
- Throbber_Impl::Throbber_Impl( uno::Reference< VCLXWindow > xParent,
- sal_Int32 nStepTime,
- sal_Bool bRepeat )
- :mrMutex( Application::GetSolarMutex() )
- {
- mxParent = xParent;
- mbRepeat = bRepeat;
- mnStepTime = nStepTime;
- maWaitTimer.SetTimeout( mnStepTime );
- maWaitTimer.SetTimeoutHdl( LINK( this, Throbber_Impl, TimeOutHdl ) );
- }
-
- //--------------------------------------------------------------------
- Throbber_Impl::~Throbber_Impl()
- {
- maWaitTimer.Stop();
- mxParent = NULL;
- }
-
- //--------------------------------------------------------------------
- void Throbber_Impl::start() throw ( uno::RuntimeException )
- {
- ::vos::OGuard aGuard( GetMutex() );
-
- mnCurStep = 0;
- maWaitTimer.Start();
- }
-
- //--------------------------------------------------------------------
- void Throbber_Impl::stop() throw ( uno::RuntimeException )
- {
- ::vos::OGuard aGuard( GetMutex() );
-
- maWaitTimer.Stop();
- }
-
- //--------------------------------------------------------------------
- void Throbber_Impl::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& rImageList )
- throw ( uno::RuntimeException )
- {
- ::vos::OGuard aGuard( GetMutex() );
-
- maImageList = rImageList;
-
- mnStepCount = maImageList.getLength();
- FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() );
- if ( pImage )
- {
- if ( mnStepCount )
- pImage->SetImage( maImageList[ 0 ] );
- else
- pImage->SetImage( Image() );
- }
- }
-
- //--------------------------------------------------------------------
- void Throbber_Impl::initImage()
- throw ( uno::RuntimeException )
- {
- FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() );
- if ( pImage && maImageList.getLength() )
- pImage->SetImage( maImageList[ 0 ] );
- }
-
- //--------------------------------------------------------------------
- sal_Bool Throbber_Impl::isHCMode()
- throw ( uno::RuntimeException )
- {
- FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() );
- if ( pImage )
- return pImage->GetSettings().GetStyleSettings().GetHighContrastMode();
- else
- return Application::GetSettings().GetStyleSettings().GetHighContrastMode();
- }
-
- // -----------------------------------------------------------------------
- IMPL_LINK( Throbber_Impl, TimeOutHdl, Throbber_Impl*, EMPTYARG )
- {
- ::vos::OGuard aGuard( GetMutex() );
-
- FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() );
-
- if ( !pImage || !maImageList.getLength() )
- return 0;
-
- if ( mnCurStep < mnStepCount - 1 )
- mnCurStep += 1;
- else
- mnCurStep = 0;
-
- pImage->SetImage( maImageList[ mnCurStep ] );
-
- return 0;
- }
-
-//........................................................................
-} // namespacetoolkit
-//........................................................................
-
diff --git a/toolkit/source/helper/tkresmgr.cxx b/toolkit/source/helper/tkresmgr.cxx
index 4e1e4153daf1..d0336c27bdf5 100644
--- a/toolkit/source/helper/tkresmgr.cxx
+++ b/toolkit/source/helper/tkresmgr.cxx
@@ -29,14 +29,21 @@
#include "precompiled_toolkit.hxx"
#include <toolkit/helper/tkresmgr.hxx>
#include <tools/simplerm.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
#ifndef _TOOLS_RESMGR_HXX_
#include <tools/resmgr.hxx>
#endif
-
+#include <tools/diagnose_ex.h>
#include <vcl/svapp.hxx>
-
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::graphic::XGraphic;
+using ::com::sun::star::graphic::XGraphicProvider;
+using namespace ::com::sun::star;
// -----------------------------------------------------------------------------
// TkResMgr
// -----------------------------------------------------------------------------
@@ -98,3 +105,27 @@ Image TkResMgr::loadImage( sal_uInt16 nResId )
}
// -----------------------------------------------------------------------------
+Image TkResMgr::getImageFromURL( const ::rtl::OUString& i_rImageURL )
+{
+ if ( !i_rImageURL.getLength() )
+ return Image();
+
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XGraphicProvider > xProvider;
+ if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ {
+ ::comphelper::NamedValueCollection aMediaProperties;
+ aMediaProperties.put( "URL", i_rImageURL );
+ Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
+ return Image( xGraphic );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return Image();
+}
+
diff --git a/toolkit/util/tk.component b/toolkit/util/tk.component
index e782283c39eb..c147d2b2521d 100644
--- a/toolkit/util/tk.component
+++ b/toolkit/util/tk.component
@@ -35,6 +35,18 @@
<service name="com.sun.star.awt.Layout"/>
<service name="com.sun.star.comp.awt.Layout"/>
</implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTabPage">
+ <service name="com.sun.star.awt.tab.UnoControlTabPage"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTabPageModel">
+ <service name="com.sun.star.awt.tab.UnoControlTabPageModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTabPageContainerModel">
+ <service name="com.sun.star.awt.tab.UnoControlTabPageContainerModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTabPageContainer">
+ <service name="com.sun.star.awt.tab.UnoControlTabPageContainer"/>
+ </implementation>
<implementation name="stardiv.Toolkit.DefaultGridColumnModel">
<service name="com.sun.star.awt.grid.DefaultGridColumnModel"/>
</implementation>
@@ -257,6 +269,15 @@
<service name="com.sun.star.awt.UnoControlSimpleAnimationModel"/>
<service name="com.sun.star.awt.UnoSimpleAnimationControlModel"/>
</implementation>
+ <implementation name="org.openoffice.comp.toolkit.SpinningProgressControlModel">
+ <service name="com.sun.star.awt.SpinningProgressControlModel"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.toolkit.AnimatedImagesControlModel">
+ <service name="com.sun.star.awt.AnimatedImagesControlModel"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.toolkit.AnimatedImagesControl">
+ <service name="com.sun.star.awt.AnimatedImagesControl"/>
+ </implementation>
<implementation name="stardiv.Toolkit.UnoSpinButtonControl">
<service name="com.sun.star.awt.UnoControlSpinButton"/>
</implementation>
diff --git a/unotools/inc/unotools/pathoptions.hxx b/unotools/inc/unotools/pathoptions.hxx
index 4d94c93cca4a..bff3a3120ee4 100644
--- a/unotools/inc/unotools/pathoptions.hxx
+++ b/unotools/inc/unotools/pathoptions.hxx
@@ -129,8 +129,9 @@ public:
void SetWorkPath( const String& rPath );
void SetPath( SvtPathOptions::Pathes ePath, const String& rNewPath );
- String SubstituteVariable( const String& rVar );
- String UseVariable( const String& rVar );
+ String SubstituteVariable( const String& rVar ) const;
+ String ExpandMacros( const String& rPath ) const;
+ String UseVariable( const String& rVar ) const;
sal_Bool SearchFile( String& rIniFile, Pathes ePath = PATH_USERCONFIG );
::com::sun::star::lang::Locale GetLocale() const;
sal_Bool IsReadonly() const;
diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx
index 3cf43a1f3bc9..d2f001d1c481 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -137,6 +137,7 @@ class SvtPathOptions_Impl
std::vector< String > m_aPathArray;
Reference< XFastPropertySet > m_xPathSettings;
Reference< XStringSubstitution > m_xSubstVariables;
+ Reference< XMacroExpander > m_xMacroExpander;
mutable EnumToHandleMap m_aMapEnumToPropHandle;
VarNameToEnumMap m_aMapVarNamesToEnum;
@@ -199,9 +200,9 @@ class SvtPathOptions_Impl
void SetUserConfigPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_USERCONFIG, rPath ); }
void SetWorkPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_WORK, rPath ); }
- rtl::OUString SubstVar( const rtl::OUString& rVar );
- rtl::OUString SubstituteAndConvert( const rtl::OUString& rPath );
- rtl::OUString UsePathVariables( const rtl::OUString& rPath );
+ rtl::OUString SubstVar( const rtl::OUString& rVar ) const;
+ rtl::OUString ExpandMacros( const rtl::OUString& rPath ) const;
+ rtl::OUString UsePathVariables( const rtl::OUString& rPath ) const;
::com::sun::star::lang::Locale GetLocale() const { return m_aLocale; }
@@ -282,33 +283,31 @@ const String& SvtPathOptions_Impl::GetPath( SvtPathOptions::Pathes ePath )
{
::osl::MutexGuard aGuard( m_aMutex );
- if ( ePath < SvtPathOptions::PATH_COUNT )
+ if ( ePath >= SvtPathOptions::PATH_COUNT )
+ return m_aEmptyString;
+
+ OUString aPathValue;
+ String aResult;
+ sal_Int32 nHandle = m_aMapEnumToPropHandle[ (sal_Int32)ePath ];
+
+ // Substitution is done by the service itself using the substition service
+ Any a = m_xPathSettings->getFastPropertyValue( nHandle );
+ a >>= aPathValue;
+ if( ePath == SvtPathOptions::PATH_ADDIN ||
+ ePath == SvtPathOptions::PATH_FILTER ||
+ ePath == SvtPathOptions::PATH_HELP ||
+ ePath == SvtPathOptions::PATH_MODULE ||
+ ePath == SvtPathOptions::PATH_PLUGIN ||
+ ePath == SvtPathOptions::PATH_STORAGE
+ )
{
- OUString aPathValue;
- String aResult;
- sal_Int32 nHandle = m_aMapEnumToPropHandle[ (sal_Int32)ePath ];
-
- // Substitution is done by the service itself using the substition service
- Any a = m_xPathSettings->getFastPropertyValue( nHandle );
- a >>= aPathValue;
- if( ePath == SvtPathOptions::PATH_ADDIN ||
- ePath == SvtPathOptions::PATH_FILTER ||
- ePath == SvtPathOptions::PATH_HELP ||
- ePath == SvtPathOptions::PATH_MODULE ||
- ePath == SvtPathOptions::PATH_PLUGIN ||
- ePath == SvtPathOptions::PATH_STORAGE
- )
- {
- // These office paths have to be converted to system pathes
- utl::LocalFileHelper::ConvertURLToPhysicalName( aPathValue, aResult );
- aPathValue = aResult;
- }
-
- m_aPathArray[ ePath ] = aPathValue;
- return m_aPathArray[ ePath ];
+ // These office paths have to be converted to system pathes
+ utl::LocalFileHelper::ConvertURLToPhysicalName( aPathValue, aResult );
+ aPathValue = aResult;
}
- return m_aEmptyString;
+ m_aPathArray[ ePath ] = aPathValue;
+ return m_aPathArray[ ePath ];
}
// -----------------------------------------------------------------------
BOOL SvtPathOptions_Impl::IsPathReadonly(SvtPathOptions::Pathes ePath)const
@@ -372,23 +371,29 @@ void SvtPathOptions_Impl::SetPath( SvtPathOptions::Pathes ePath, const String& r
}
}
-// -----------------------------------------------------------------------
+//-------------------------------------------------------------------------
-OUString SvtPathOptions_Impl::SubstituteAndConvert( const rtl::OUString& rPath )
+OUString SvtPathOptions_Impl::ExpandMacros( const rtl::OUString& rPath ) const
{
- return SubstVar( rPath );
+ ::rtl::OUString sExpanded( rPath );
+
+ const INetURLObject aParser( rPath );
+ if ( aParser.GetProtocol() == INET_PROT_VND_SUN_STAR_EXPAND )
+ sExpanded = m_xMacroExpander->expandMacros( aParser.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ) );
+
+ return sExpanded;
}
//-------------------------------------------------------------------------
-OUString SvtPathOptions_Impl::UsePathVariables( const OUString& rPath )
+OUString SvtPathOptions_Impl::UsePathVariables( const OUString& rPath ) const
{
return m_xSubstVariables->reSubstituteVariables( rPath );
}
// -----------------------------------------------------------------------
-OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar )
+OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) const
{
// Don't work at parameter-string directly. Copy it.
OUString aWorkText = rVar;
@@ -483,18 +488,9 @@ SvtPathOptions_Impl::SvtPathOptions_Impl() :
Reference< XInterface >() );
}
- m_xSubstVariables = Reference< XStringSubstitution >( xSMgr->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.PathSubstitution" ))),
- UNO_QUERY );
- if ( !m_xSubstVariables.is() )
- {
- // #112719#: check for existance
- DBG_ERROR( "SvtPathOptions_Impl::SvtPathOptions_Impl(): #112719# happened again!" );
- throw RuntimeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Service com.sun.star.util.PathSubstitution cannot be created" )),
- Reference< XInterface >() );
- }
+ ::comphelper::ComponentContext aContext( xSMgr );
+ m_xSubstVariables.set( aContext.createComponent( "com.sun.star.util.PathSubstitution" ), UNO_QUERY_THROW );
+ m_xMacroExpander.set( aContext.getSingleton( "com.sun.star.util.theMacroExpander" ), UNO_QUERY_THROW );
// Create temporary hash map to have a mapping between property names and property handles
Reference< XPropertySet > xPropertySet = Reference< XPropertySet >( m_xPathSettings, UNO_QUERY );
@@ -905,13 +901,22 @@ void SvtPathOptions::SetWorkPath( const String& rPath )
// -----------------------------------------------------------------------
-String SvtPathOptions::SubstituteVariable( const String& rVar )
+String SvtPathOptions::SubstituteVariable( const String& rVar ) const
{
- String aRet = pImp->SubstituteAndConvert( rVar );
+ String aRet = pImp->SubstVar( rVar );
return aRet;
}
-String SvtPathOptions::UseVariable( const String& rPath )
+// -----------------------------------------------------------------------
+
+String SvtPathOptions::ExpandMacros( const String& rPath ) const
+{
+ return pImp->ExpandMacros( rPath );
+}
+
+// -----------------------------------------------------------------------
+
+String SvtPathOptions::UseVariable( const String& rPath ) const
{
String aRet = pImp->UsePathVariables( rPath );
return aRet;
@@ -982,7 +987,7 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath )
case PATH_TEMPLATE: aPath = GetTemplatePath(); break;
case PATH_WORK: aPath = GetWorkPath(); break;
case PATH_UICONFIG: aPath = GetUIConfigPath(); break;
- case PATH_FINGERPRINT: aPath = GetFingerprintPath(); break;
+ case PATH_FINGERPRINT: aPath = GetFingerprintPath(); break;
case PATH_USERCONFIG:/*-Wall???*/ break;
case PATH_COUNT: /*-Wall???*/ break;
}
diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx
index 4460694420a0..4e068fc32731 100644
--- a/vcl/inc/vcl/fixed.hxx
+++ b/vcl/inc/vcl/fixed.hxx
@@ -167,10 +167,10 @@ private:
SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
SAL_DLLPRIVATE void ImplInitSettings();
- SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
- const Point& rPos, const Size& rSize );
protected:
+ SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
+ const Point& rPos, const Size& rSize );
SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
public:
diff --git a/vcl/inc/vcl/imgctrl.hxx b/vcl/inc/vcl/imgctrl.hxx
index fa3b01463f34..25c1e395c837 100644
--- a/vcl/inc/vcl/imgctrl.hxx
+++ b/vcl/inc/vcl/imgctrl.hxx
@@ -40,28 +40,26 @@
class VCL_DLLPUBLIC ImageControl : public FixedImage
{
private:
- BitmapEx maBmp;
- BitmapEx maBmpHC;
::sal_Int16 mnScaleMode;
public:
ImageControl( Window* pParent, WinBits nStyle = 0 );
+ ImageControl( Window* pParent, const ResId& rResId );
// set/get the scale mode. This is one of the css.awt.ImageScaleMode constants
void SetScaleMode( const ::sal_Int16 _nMode );
::sal_Int16 GetScaleMode() const { return mnScaleMode; }
virtual void Resize();
- virtual void UserDraw( const UserDrawEvent& rUDEvt );
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags );
virtual void Paint( const Rectangle& rRect );
virtual void GetFocus();
virtual void LoseFocus();
- void SetBitmap( const BitmapEx& rBmp );
- using OutputDevice::GetBitmap;
- const BitmapEx& GetBitmap() const { return maBmp; }
- BOOL SetModeBitmap( const BitmapEx& rBitmap, BmpColorMode eMode = BMP_COLOR_NORMAL );
- const BitmapEx& GetModeBitmap( BmpColorMode eMode = BMP_COLOR_NORMAL ) const;
+protected:
+ void ImplDraw( OutputDevice& rDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize ) const;
+private:
+ using FixedImage::ImplDraw;
};
#endif // _SV_IMGCTRL_HXX
diff --git a/vcl/inc/vcl/throbber.hxx b/vcl/inc/vcl/throbber.hxx
new file mode 100644
index 000000000000..f86a9944e28f
--- /dev/null
+++ b/vcl/inc/vcl/throbber.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * 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 VCL_THROBBER_HXX
+#define VCL_THROBBER_HXX
+
+#include "vcl/dllapi.h"
+#include "vcl/imgctrl.hxx"
+#include "vcl/timer.hxx"
+
+#include <vos/mutex.hxx>
+
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+#include <vector>
+
+class VCL_DLLPUBLIC Throbber : public ImageControl
+{
+public:
+ enum ImageSet
+ {
+ /// no (default) images at all
+ IMAGES_NONE,
+ /// automatically decide between different image sets, depending on what fits best the actual size
+ IMAGES_AUTO,
+ /// default images, 16x16 pixels
+ IMAGES_16_PX,
+ /// default images, 32x32 pixels
+ IMAGES_32_PX,
+ /// default images, 64x64 pixels
+ IMAGES_64_PX,
+ };
+
+public:
+ Throbber( Window* i_parentWindow, WinBits i_style, const ImageSet i_imageSet = IMAGES_AUTO );
+ Throbber( Window* i_parentWindow, const ResId& i_resId, const ImageSet i_imageSet = IMAGES_AUTO );
+ ~Throbber();
+
+ // Properties
+ void setStepTime( sal_Int32 nStepTime ) { mnStepTime = nStepTime; }
+ sal_Int32 getStepTime() const { return mnStepTime; }
+
+ void setRepeat( sal_Bool bRepeat ) { mbRepeat = bRepeat; }
+ sal_Bool getRepeat() const { return mbRepeat; }
+
+ // animation control
+ void start();
+ void stop();
+ bool isRunning() const;
+
+ void setImageList( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& ImageList );
+ void setImageList( ::std::vector< Image > const& i_images );
+
+ // default images
+ static ::std::vector< ::rtl::OUString >
+ getDefaultImageURLs( const ImageSet i_imageSet );
+
+protected:
+ // Window overridables
+ virtual void Resize();
+
+private:
+ SAL_DLLPRIVATE void initImages();
+
+private:
+ ::std::vector< Image > maImageList;
+
+ sal_Bool mbRepeat;
+ sal_Int32 mnStepTime;
+ sal_Int32 mnCurStep;
+ sal_Int32 mnStepCount;
+ AutoTimer maWaitTimer;
+ ImageSet meImageSet;
+
+ DECL_LINK( TimeOutHdl, void* );
+};
+
+#endif // VCL_THROBBER_HXX
+
diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst
index d99694fdd458..5a7dd7d9ef91 100644
--- a/vcl/prj/d.lst
+++ b/vcl/prj/d.lst
@@ -58,6 +58,7 @@ mkdir: %_DEST%\inc%_EXT%\vcl
..\inc\vcl\image.hxx %_DEST%\inc%_EXT%\vcl\image.hxx
..\inc\vcl\imagerepository.hxx %_DEST%\inc%_EXT%\vcl\imagerepository.hxx
..\inc\vcl\imgctrl.hxx %_DEST%\inc%_EXT%\vcl\imgctrl.hxx
+..\inc\vcl\throbber.hxx %_DEST%\inc%_EXT%\vcl\throbber.hxx
..\inc\vcl\impdel.hxx %_DEST%\inc%_EXT%\vcl\impdel.hxx
..\inc\vcl\inputctx.hxx %_DEST%\inc%_EXT%\vcl\inputctx.hxx
..\inc\vcl\javachild.hxx %_DEST%\inc%_EXT%\vcl\javachild.hxx
diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx
index 075a8b1b95e2..662efd407995 100644
--- a/vcl/source/control/imgctrl.cxx
+++ b/vcl/source/control/imgctrl.cxx
@@ -30,6 +30,7 @@
#include <vcl/event.hxx>
#include <vcl/imgctrl.hxx>
+#include <tools/rcid.h>
#include <com/sun/star/awt/ImageScaleMode.hdl>
@@ -37,10 +38,18 @@ namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
// -----------------------------------------------------------------------
-ImageControl::ImageControl( Window* pParent, WinBits nStyle ) :
- FixedImage( pParent, nStyle )
+ImageControl::ImageControl( Window* pParent, WinBits nStyle )
+ :FixedImage( pParent, nStyle )
+ ,mnScaleMode( ImageScaleMode::Anisotropic )
+{
+}
+
+// -----------------------------------------------------------------------
+
+ImageControl::ImageControl( Window* pParent, const ResId& rResId )
+ :FixedImage( pParent, rResId )
+ ,mnScaleMode( ImageScaleMode::Anisotropic )
{
- mnScaleMode = ImageScaleMode::Anisotropic;
}
// -----------------------------------------------------------------------
@@ -86,17 +95,24 @@ namespace
// -----------------------------------------------------------------------
-void ImageControl::UserDraw( const UserDrawEvent& rUDEvt )
+void ImageControl::ImplDraw( OutputDevice& rDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize ) const
{
USHORT nStyle = 0;
- BitmapEx* pBitmap = &maBmp;
- if( !!maBmpHC )
+ if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) )
{
- if( GetSettings().GetStyleSettings().GetHighContrastMode() )
- pBitmap = &maBmpHC;
+ if ( !IsEnabled() )
+ nStyle |= IMAGE_DRAW_DISABLE;
}
- if ( !*pBitmap )
+ const Image& rImage( GetModeImage( BMP_COLOR_NORMAL ) );
+ const Image& rImageHC( GetModeImage( BMP_COLOR_HIGHCONTRAST ) );
+
+ const Image* pImage = &rImage;
+ if ( !!rImageHC && GetSettings().GetStyleSettings().GetHighContrastMode() )
+ pImage = &rImageHC;
+
+ const Rectangle aDrawRect( rPos, rSize );
+ if ( !*pImage )
{
String sText( GetText() );
if ( !sText.Len() )
@@ -104,131 +120,56 @@ void ImageControl::UserDraw( const UserDrawEvent& rUDEvt )
WinBits nWinStyle = GetStyle();
USHORT nTextStyle = FixedText::ImplGetTextStyle( nWinStyle );
- if ( !IsEnabled() )
- nTextStyle |= TEXT_DRAW_DISABLE;
+ if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) )
+ if ( !IsEnabled() )
+ nTextStyle |= TEXT_DRAW_DISABLE;
- DrawText( rUDEvt.GetRect(), sText, nTextStyle );
+ rDev.DrawText( aDrawRect, sText, nTextStyle );
return;
}
- const Rectangle& rPaintRect = rUDEvt.GetRect();
- const Size& rBitmapSize = maBmp.GetSizePixel();
+ const Size& rBitmapSize = pImage->GetSizePixel();
- if( nStyle & IMAGE_DRAW_COLORTRANSFORM )
+ switch ( mnScaleMode )
{
- // only images support IMAGE_DRAW_COLORTRANSFORM
- Image aImage( *pBitmap );
- if ( !!aImage )
- {
- switch ( mnScaleMode )
- {
- case ImageScaleMode::None:
- {
- rUDEvt.GetDevice()->DrawImage(
- lcl_centerWithin( rPaintRect, rBitmapSize ), aImage, nStyle );
- }
- break;
-
- case ImageScaleMode::Isotropic:
- {
- const Size aPaintSize = lcl_calcPaintSize( rPaintRect, rBitmapSize );
- rUDEvt.GetDevice()->DrawImage(
- lcl_centerWithin( rPaintRect, aPaintSize ),
- aPaintSize,
- aImage, nStyle );
- }
- break;
-
- case ImageScaleMode::Anisotropic:
- {
- rUDEvt.GetDevice()->DrawImage(
- rPaintRect.TopLeft(),
- rPaintRect.GetSize(),
- aImage, nStyle );
- }
- break;
-
- default:
- OSL_ENSURE( false, "ImageControl::UserDraw: unhandled scale mode!" );
- break;
-
- } // switch ( mnScaleMode )
- }
- }
- else
+ case ImageScaleMode::None:
{
- switch ( mnScaleMode )
- {
- case ImageScaleMode::None:
- {
- pBitmap->Draw( rUDEvt.GetDevice(), lcl_centerWithin( rPaintRect, rBitmapSize ) );
- }
- break;
-
- case ImageScaleMode::Isotropic:
- {
- const Size aPaintSize = lcl_calcPaintSize( rPaintRect, rBitmapSize );
- pBitmap->Draw( rUDEvt.GetDevice(),
- lcl_centerWithin( rPaintRect, aPaintSize ),
- aPaintSize );
- }
- break;
-
- case ImageScaleMode::Anisotropic:
- {
- pBitmap->Draw( rUDEvt.GetDevice(),
- rPaintRect.TopLeft(),
- rPaintRect.GetSize() );
- }
- break;
-
- default:
- OSL_ENSURE( false, "ImageControl::UserDraw: unhandled scale mode!" );
- break;
-
- } // switch ( mnScaleMode )
+ rDev.DrawImage( lcl_centerWithin( aDrawRect, rBitmapSize ), *pImage, nStyle );
}
-}
+ break;
-// -----------------------------------------------------------------------
-
-void ImageControl::SetBitmap( const BitmapEx& rBmp )
-{
- maBmp = rBmp;
- StateChanged( STATE_CHANGE_DATA );
-}
-
-// -----------------------------------------------------------------------
+ case ImageScaleMode::Isotropic:
+ {
+ const Size aPaintSize = lcl_calcPaintSize( aDrawRect, rBitmapSize );
+ rDev.DrawImage(
+ lcl_centerWithin( aDrawRect, aPaintSize ),
+ aPaintSize,
+ *pImage, nStyle );
+ }
+ break;
-BOOL ImageControl::SetModeBitmap( const BitmapEx& rBitmap, BmpColorMode eMode )
-{
- if( eMode == BMP_COLOR_NORMAL )
- SetBitmap( rBitmap );
- else if( eMode == BMP_COLOR_HIGHCONTRAST )
+ case ImageScaleMode::Anisotropic:
{
- maBmpHC = rBitmap;
- StateChanged( STATE_CHANGE_DATA );
+ rDev.DrawImage(
+ aDrawRect.TopLeft(),
+ aDrawRect.GetSize(),
+ *pImage, nStyle );
}
- else
- return FALSE;
- return TRUE;
-}
+ break;
-// -----------------------------------------------------------------------
+ default:
+ OSL_ENSURE( false, "ImageControl::ImplDraw: unhandled scale mode!" );
+ break;
-const BitmapEx& ImageControl::GetModeBitmap( BmpColorMode eMode ) const
-{
- if( eMode == BMP_COLOR_HIGHCONTRAST )
- return maBmpHC;
- else
- return maBmp;
+ } // switch ( mnScaleMode )
}
// -----------------------------------------------------------------------
-void ImageControl::Paint( const Rectangle& rRect )
+void ImageControl::Paint( const Rectangle& /*rRect*/ )
{
- FixedImage::Paint( rRect );
+ ImplDraw( *this, 0, Point(), GetOutputSizePixel() );
+
if( HasFocus() )
{
Window *pWin = GetWindow( WINDOW_BORDER );
@@ -252,6 +193,27 @@ void ImageControl::Paint( const Rectangle& rRect )
}
// -----------------------------------------------------------------------
+void ImageControl::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags )
+{
+ const Point aPos = pDev->LogicToPixel( rPos );
+ const Size aSize = pDev->LogicToPixel( rSize );
+ Rectangle aRect( aPos, aSize );
+
+ pDev->Push();
+ pDev->SetMapMode();
+
+ // Border
+ if ( !(nFlags & WINDOW_DRAW_NOBORDER) && (GetStyle() & WB_BORDER) )
+ {
+ ImplDrawFrame( pDev, aRect );
+ }
+ pDev->IntersectClipRegion( aRect );
+ ImplDraw( *pDev, nFlags, aRect.TopLeft(), aRect.GetSize() );
+
+ pDev->Pop();
+}
+
+// -----------------------------------------------------------------------
void ImageControl::GetFocus()
{
diff --git a/vcl/source/control/makefile.mk b/vcl/source/control/makefile.mk
index b1644e58ccd9..de2613b1084f 100644
--- a/vcl/source/control/makefile.mk
+++ b/vcl/source/control/makefile.mk
@@ -43,16 +43,21 @@ CDEFS+=-D_STD_NO_NAMESPACE -D_VOS_NO_NAMESPACE -D_UNO_NO_NAMESPACE
# --- Files --------------------------------------------------------
-SLOFILES= $(SLO)$/button.obj \
+EXCEPTIONSFILES= \
+ $(SLO)$/button.obj \
$(SLO)$/ctrl.obj \
- $(SLO)$/combobox.obj \
$(SLO)$/edit.obj \
- $(SLO)$/field.obj \
$(SLO)$/field2.obj \
+ $(SLO)$/ilstbox.obj \
+ $(SLO)$/tabctrl.obj \
+ $(SLO)$/throbber.obj
+
+SLOFILES= $(EXCEPTIONSFILES) \
+ $(SLO)$/combobox.obj \
+ $(SLO)$/field.obj \
$(SLO)$/fixbrd.obj \
$(SLO)$/fixed.obj \
$(SLO)$/group.obj \
- $(SLO)$/ilstbox.obj \
$(SLO)$/imgctrl.obj \
$(SLO)$/longcurr.obj \
$(SLO)$/lstbox.obj \
@@ -62,19 +67,12 @@ SLOFILES= $(SLO)$/button.obj \
$(SLO)$/slider.obj \
$(SLO)$/spinfld.obj \
$(SLO)$/spinbtn.obj \
- $(SLO)$/tabctrl.obj \
$(SLO)$/quickselectionengine.obj
-EXCEPTIONSFILES= \
- $(SLO)$/button.obj \
- $(SLO)$/ctrl.obj \
- $(SLO)$/edit.obj \
- $(SLO)$/field2.obj \
- $(SLO)$/ilstbox.obj \
- $(SLO)$/tabctrl.obj
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx
new file mode 100644
index 000000000000..6ebd02cb5de1
--- /dev/null
+++ b/vcl/source/control/throbber.cxx
@@ -0,0 +1,325 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_vcl.hxx"
+
+#include "vcl/throbber.hxx"
+#include "vcl/svapp.hxx"
+
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/processfactory.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/urlobj.hxx>
+
+#include <limits>
+
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::graphic::XGraphic;
+using ::com::sun::star::graphic::XGraphicProvider;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::Exception;
+namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
+
+//----------------------------------------------------------------------------------------------------------------------
+Throbber::Throbber( Window* i_parentWindow, WinBits i_style, const ImageSet i_imageSet )
+ :ImageControl( i_parentWindow, i_style )
+ ,mbRepeat( sal_True )
+ ,mnStepTime( 100 )
+ ,mnCurStep( 0 )
+ ,mnStepCount( 0 )
+ ,meImageSet( i_imageSet )
+{
+ maWaitTimer.SetTimeout( mnStepTime );
+ maWaitTimer.SetTimeoutHdl( LINK( this, Throbber, TimeOutHdl ) );
+
+ SetScaleMode( ImageScaleMode::None );
+ initImages();
+}
+
+//--------------------------------------------------------------------
+Throbber::Throbber( Window* i_parentWindow, const ResId& i_resId, const ImageSet i_imageSet )
+ :ImageControl( i_parentWindow, i_resId )
+ ,mbRepeat( sal_True )
+ ,mnStepTime( 100 )
+ ,mnCurStep( 0 )
+ ,mnStepCount( 0 )
+ ,meImageSet( i_imageSet )
+{
+ maWaitTimer.SetTimeout( mnStepTime );
+ maWaitTimer.SetTimeoutHdl( LINK( this, Throbber, TimeOutHdl ) );
+
+ SetScaleMode( ImageScaleMode::None );
+ initImages();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+Throbber::~Throbber()
+{
+ maWaitTimer.Stop();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+namespace
+{
+ //..................................................................................................................
+ ::rtl::OUString lcl_getHighContrastURL( ::rtl::OUString const& i_imageURL )
+ {
+ INetURLObject aURL( i_imageURL );
+ if ( aURL.GetProtocol() != INET_PROT_PRIV_SOFFICE )
+ {
+ OSL_VERIFY( aURL.insertName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hicontrast" ) ), false, 0 ) );
+ return aURL.GetMainURL( INetURLObject::NO_DECODE );
+ }
+ // the private: scheme is not considered to be hierarchical by INetURLObject, so manually insert the
+ // segment
+ const sal_Int32 separatorPos = i_imageURL.indexOf( '/' );
+ ENSURE_OR_RETURN( separatorPos != -1, "lcl_getHighContrastURL: unsipported URL scheme - cannot automatically determine HC version!", i_imageURL );
+
+ ::rtl::OUStringBuffer composer;
+ composer.append( i_imageURL.copy( 0, separatorPos ) );
+ composer.appendAscii( "/hicontrast" );
+ composer.append( i_imageURL.copy( separatorPos ) );
+ return composer.makeStringAndClear();
+ }
+
+ //..................................................................................................................
+ ::std::vector< Image > lcl_loadImageSet( const Throbber::ImageSet i_imageSet, const bool i_isHiContrast )
+ {
+ ::std::vector< Image > aImages;
+ ENSURE_OR_RETURN( i_imageSet != Throbber::IMAGES_NONE, "lcl_loadImageSet: illegal image set", aImages );
+
+ const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW );
+
+ ::std::vector< ::rtl::OUString > aImageURLs( Throbber::getDefaultImageURLs( i_imageSet ) );
+ aImages.reserve( aImageURLs.size() );
+
+ ::comphelper::NamedValueCollection aMediaProperties;
+ for ( ::std::vector< ::rtl::OUString >::const_iterator imageURL = aImageURLs.begin();
+ imageURL != aImageURLs.end();
+ ++imageURL
+ )
+ {
+ Reference< XGraphic > xGraphic;
+ if ( i_isHiContrast )
+ {
+ aMediaProperties.put( "URL", lcl_getHighContrastURL( *imageURL ) );
+ xGraphic.set( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY );
+ }
+ if ( !xGraphic.is() )
+ {
+ aMediaProperties.put( "URL", *imageURL );
+ xGraphic.set( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY );
+ }
+ aImages.push_back( Image( xGraphic ) );
+ }
+
+ return aImages;
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void Throbber::Resize()
+{
+ ImageControl::Resize();
+
+ if ( meImageSet == IMAGES_AUTO )
+ initImages();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void Throbber::initImages()
+{
+ if ( meImageSet == IMAGES_NONE )
+ return;
+
+ try
+ {
+ ::std::vector< ::std::vector< Image > > aImageSets;
+ const bool isHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+ if ( meImageSet == IMAGES_AUTO )
+ {
+ aImageSets.push_back( lcl_loadImageSet( IMAGES_16_PX, isHiContrast ) );
+ aImageSets.push_back( lcl_loadImageSet( IMAGES_32_PX, isHiContrast ) );
+ aImageSets.push_back( lcl_loadImageSet( IMAGES_64_PX, isHiContrast ) );
+ }
+ else
+ {
+ aImageSets.push_back( lcl_loadImageSet( meImageSet, isHiContrast ) );
+ }
+
+ // find the best matching image set (size-wise)
+ const ::Size aWindowSizePixel = GetSizePixel();
+ size_t nPreferredSet = 0;
+ if ( aImageSets.size() > 1 )
+ {
+ long nMinimalDistance = ::std::numeric_limits< long >::max();
+ for ( ::std::vector< ::std::vector< Image > >::const_iterator check = aImageSets.begin();
+ check != aImageSets.end();
+ ++check
+ )
+ {
+ ENSURE_OR_CONTINUE( !check->empty(), "Throbber::initImages: illegal image!" );
+ const Size aImageSize = (*check)[0].GetSizePixel();
+
+ if ( ( aImageSize.Width() > aWindowSizePixel.Width() )
+ || ( aImageSize.Height() > aWindowSizePixel.Height() )
+ )
+ // do not use an image set which doesn't fit into the window
+ continue;
+
+ const sal_Int64 distance =
+ ( aWindowSizePixel.Width() - aImageSize.Width() ) * ( aWindowSizePixel.Width() - aImageSize.Width() )
+ + ( aWindowSizePixel.Height() - aImageSize.Height() ) * ( aWindowSizePixel.Height() - aImageSize.Height() );
+ if ( distance < nMinimalDistance )
+ {
+ nMinimalDistance = distance;
+ nPreferredSet = check - aImageSets.begin();
+ }
+ }
+ }
+
+ if ( nPreferredSet < aImageSets.size() )
+ setImageList( aImageSets[nPreferredSet] );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void Throbber::start()
+{
+ maWaitTimer.Start();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void Throbber::stop()
+{
+ maWaitTimer.Stop();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+bool Throbber::isRunning() const
+{
+ return maWaitTimer.IsActive();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void Throbber::setImageList( ::std::vector< Image > const& i_images )
+{
+ maImageList = i_images;
+
+ mnStepCount = maImageList.size();
+ const Image aInitialImage( mnStepCount ? maImageList[ 0 ] : Image() );
+ SetImage( aInitialImage );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void Throbber::setImageList( const Sequence< Reference< XGraphic > >& rImageList )
+{
+ ::std::vector< Image > aImages( rImageList.getLength() );
+ ::std::copy(
+ rImageList.getConstArray(),
+ rImageList.getConstArray() + rImageList.getLength(),
+ aImages.begin()
+ );
+ setImageList( aImages );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+::std::vector< ::rtl::OUString > Throbber::getDefaultImageURLs( const ImageSet i_imageSet )
+{
+ ::std::vector< ::rtl::OUString > aImageURLs;
+
+ sal_Char const* const pResolutions[] = { "16", "32", "64" };
+ size_t const nImageCounts[] = { 6, 12, 12 };
+
+ size_t index = 0;
+ switch ( i_imageSet )
+ {
+ case IMAGES_16_PX: index = 0; break;
+ case IMAGES_32_PX: index = 1; break;
+ case IMAGES_64_PX: index = 2; break;
+ case IMAGES_NONE:
+ case IMAGES_AUTO:
+ OSL_ENSURE( false, "Throbber::getDefaultImageURLs: illegal image set!" );
+ return aImageURLs;
+ }
+
+ aImageURLs.reserve( nImageCounts[index] );
+ for ( size_t i=0; i<nImageCounts[index]; ++i )
+ {
+ ::rtl::OUStringBuffer aURL;
+ aURL.appendAscii( "private:graphicrepository/shared/spinner-" );
+ aURL.appendAscii( pResolutions[index] );
+ aURL.appendAscii( "-" );
+ if ( i < 9 )
+ aURL.appendAscii( "0" );
+ aURL.append ( sal_Int32( i + 1 ) );
+ aURL.appendAscii( ".png" );
+
+ aImageURLs.push_back( aURL.makeStringAndClear() );
+ }
+
+ return aImageURLs;
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+IMPL_LINK( Throbber, TimeOutHdl, void*, EMPTYARG )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( maImageList.empty() )
+ return 0;
+
+ if ( mnCurStep < mnStepCount - 1 )
+ mnCurStep += 1;
+ else
+ {
+ if ( mbRepeat )
+ {
+ // start over
+ mnCurStep = 0;
+ }
+ else
+ {
+ stop();
+ }
+ }
+
+ SetImage( maImageList[ mnCurStep ] );
+
+ return 0;
+}
diff --git a/vcl/source/src/makefile.mk b/vcl/source/src/makefile.mk
index 40b7d4e75dfe..161d821573b9 100644
--- a/vcl/source/src/makefile.mk
+++ b/vcl/source/src/makefile.mk
@@ -44,7 +44,8 @@ SRC1FILES= images.src \
helptext.src \
units.src \
btntext.src \
- print.src
+ print.src \
+ throbber.src \
RESLIB1NAME= $(RESTARGET)
RESLIB1IMAGES= $(PRJ)$/source/src
diff --git a/vcl/source/src/throbber.src b/vcl/source/src/throbber.src
new file mode 100755
index 000000000000..d3c5ea44035c
--- /dev/null
+++ b/vcl/source/src/throbber.src
@@ -0,0 +1,114 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+// TODO: we need a mechanism to add images to images.zip, *without*
+// referring them in resource files. The below resources are never loaded
+// at runtime, instead, the images in images.zip are accessed via
+// private:graphicrepository/* URLs.
+
+Resource 1000
+{
+ Image 1 { ImageBitmap = Bitmap{ file = "shared/spinner-16-01.png"; }; };
+ Image 2 { ImageBitmap = Bitmap{ file = "shared/spinner-16-02.png"; }; };
+ Image 3 { ImageBitmap = Bitmap{ file = "shared/spinner-16-03.png"; }; };
+ Image 4 { ImageBitmap = Bitmap{ file = "shared/spinner-16-04.png"; }; };
+ Image 5 { ImageBitmap = Bitmap{ file = "shared/spinner-16-05.png"; }; };
+ Image 6 { ImageBitmap = Bitmap{ file = "shared/spinner-16-06.png"; }; };
+};
+
+Resource 1001
+{
+ Image 1 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-16-01.png"; }; };
+ Image 2 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-16-02.png"; }; };
+ Image 3 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-16-03.png"; }; };
+ Image 4 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-16-04.png"; }; };
+ Image 5 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-16-05.png"; }; };
+ Image 6 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-16-06.png"; }; };
+};
+
+Resource 1002
+{
+ Image 1 { ImageBitmap = Bitmap{ file = "shared/spinner-32-01.png"; }; };
+ Image 2 { ImageBitmap = Bitmap{ file = "shared/spinner-32-02.png"; }; };
+ Image 3 { ImageBitmap = Bitmap{ file = "shared/spinner-32-03.png"; }; };
+ Image 4 { ImageBitmap = Bitmap{ file = "shared/spinner-32-04.png"; }; };
+ Image 5 { ImageBitmap = Bitmap{ file = "shared/spinner-32-05.png"; }; };
+ Image 6 { ImageBitmap = Bitmap{ file = "shared/spinner-32-06.png"; }; };
+ Image 7 { ImageBitmap = Bitmap{ file = "shared/spinner-32-07.png"; }; };
+ Image 8 { ImageBitmap = Bitmap{ file = "shared/spinner-32-08.png"; }; };
+ Image 9 { ImageBitmap = Bitmap{ file = "shared/spinner-32-09.png"; }; };
+ Image 10 { ImageBitmap = Bitmap{ file = "shared/spinner-32-10.png"; }; };
+ Image 11 { ImageBitmap = Bitmap{ file = "shared/spinner-32-11.png"; }; };
+ Image 12 { ImageBitmap = Bitmap{ file = "shared/spinner-32-12.png"; }; };
+};
+
+Resource 1003
+{
+ Image 1 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-01.png"; }; };
+ Image 2 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-02.png"; }; };
+ Image 3 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-03.png"; }; };
+ Image 4 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-04.png"; }; };
+ Image 5 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-05.png"; }; };
+ Image 6 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-06.png"; }; };
+ Image 7 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-07.png"; }; };
+ Image 8 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-08.png"; }; };
+ Image 9 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-09.png"; }; };
+ Image 10 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-10.png"; }; };
+ Image 11 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-11.png"; }; };
+ Image 12 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-32-12.png"; }; };
+};
+
+Resource 1004
+{
+ Image 1 { ImageBitmap = Bitmap{ file = "shared/spinner-64-01.png"; }; };
+ Image 2 { ImageBitmap = Bitmap{ file = "shared/spinner-64-02.png"; }; };
+ Image 3 { ImageBitmap = Bitmap{ file = "shared/spinner-64-03.png"; }; };
+ Image 4 { ImageBitmap = Bitmap{ file = "shared/spinner-64-04.png"; }; };
+ Image 5 { ImageBitmap = Bitmap{ file = "shared/spinner-64-05.png"; }; };
+ Image 6 { ImageBitmap = Bitmap{ file = "shared/spinner-64-06.png"; }; };
+ Image 7 { ImageBitmap = Bitmap{ file = "shared/spinner-64-07.png"; }; };
+ Image 8 { ImageBitmap = Bitmap{ file = "shared/spinner-64-08.png"; }; };
+ Image 9 { ImageBitmap = Bitmap{ file = "shared/spinner-64-09.png"; }; };
+ Image 10 { ImageBitmap = Bitmap{ file = "shared/spinner-64-10.png"; }; };
+ Image 11 { ImageBitmap = Bitmap{ file = "shared/spinner-64-11.png"; }; };
+ Image 12 { ImageBitmap = Bitmap{ file = "shared/spinner-64-12.png"; }; };
+};
+
+Resource 1005
+{
+ Image 1 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-01.png"; }; };
+ Image 2 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-02.png"; }; };
+ Image 3 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-03.png"; }; };
+ Image 4 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-04.png"; }; };
+ Image 5 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-05.png"; }; };
+ Image 6 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-06.png"; }; };
+ Image 7 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-07.png"; }; };
+ Image 8 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-08.png"; }; };
+ Image 9 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-09.png"; }; };
+ Image 10 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-10.png"; }; };
+ Image 11 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-11.png"; }; };
+ Image 12 { ImageBitmap = Bitmap{ file = "hicontrast/shared/spinner-64-12.png"; }; };
+};
diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx
index 61ed22ca95e7..0746dbfc0379 100644
--- a/vcl/workben/svpclient.cxx
+++ b/vcl/workben/svpclient.cxx
@@ -291,7 +291,7 @@ IMPL_LINK( MyWin, SelectHdl, ListBox*, )
aFixedSize.Width() += 10;
aFixedSize.Height() += 10;
m_aImage.SetSizePixel( aFixedSize );
- m_aImage.SetBitmap( BitmapEx( aBitmap ) );
+ m_aImage.SetImage( Image( BitmapEx( aBitmap ) ) );
}
return 0;
}