[Libreoffice-commits] core.git: Branch 'feature/gsoc-tiled-rendering' - 222 commits - accessibility/source basctl/source basegfx/source basic/inc basic/source bridges/source canvas/source chart2/source comphelper/source compilerplugins/clang connectivity/source cppcanvas/source cppuhelper/qa cppuhelper/source cppu/source cui/source dbaccess/source desktop/source drawinglayer/source editeng/source embeddedobj/source embedserv/source extensions/qa extensions/source external/expat external/libetonyek filter/source forms/source formula/source framework/inc framework/qa framework/source helpcompiler/inc helpcompiler/source helpcontent2 i18npool/inc i18npool/source icon-themes/breeze icon-themes/sifr icon-themes/tango_testing idl/source include/cppuhelper include/editeng include/formula include/LibreOfficeKit include/o3tl include/oox include/rtl include/sfx2 include/svl include/svtools include/svx include/toolkit include/unotools include/vbahelper include/vcl javaunohelper/source librelogo/source libre officekit/qa libreofficekit/source linguistic/source lotuswordpro/source odk/examples officecfg/registry package/inc package/source pyuno/source qadevOOo/runner qadevOOo/tests reportdesign/source sal/qa sal/rtl sal/util scaddins/source sc/inc sc/qa scripting/java scripting/source sc/source sc/uiconfig sd/source sd/uiconfig sfx2/qa sfx2/source shell/source solenv/bin sot/source svgio/source svl/source svtools/source svx/source sw/inc sw/qa sw/source toolkit/source ucbhelper/source ucb/source unotest/source unotools/source vbahelper/source vcl/generic vcl/headless vcl/inc vcl/osx vcl/qa vcl/source vcl/unx vcl/win vcl/workben wizards/com writerfilter/source xmloff/source xmlsecurity/source
Pranav Kant
pranavk at gnome.org
Mon Jun 29 01:16:37 PDT 2015
Rebased ref, commits from common ancestor:
commit 2e97441a31c16b2e8ca77d3a8de0ba44b36defda
Author: Pranav Kant <pranavk at gnome.org>
Date: Mon Jun 29 13:34:24 2015 +0530
gtktiledviewer: Don't continue on widget init failure
Change-Id: I5916357903fad5878d29bc31f21af45816a45ec5
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index db465cb..f7b065c 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -520,8 +520,8 @@ int main( int argc, char* argv[] )
// Docview
pDocView = lok_doc_view_new (argv[1], NULL, NULL);
- if (pDocView == NULL)
- g_error ("Error while creating LOKDocView widget");
+ g_assert_nonnull(pDocView);
+
g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL);
g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL);
g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL);
commit 8ed68c621bb717111105d340a61081d9f8ff8055
Author: Pranav Kant <pranavk at gnome.org>
Date: Wed Jun 24 02:02:39 2015 +0530
lokdocview: Handle DELETE key
Change-Id: I58d0c36decf81c812c108458b449402416ebcc2d
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index ca7167b..62f1e61 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -245,6 +245,9 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent)
case GDK_KEY_BackSpace:
nKeyCode = com::sun::star::awt::Key::BACKSPACE;
break;
+ case GDK_KEY_Delete:
+ nKeyCode = com::sun::star::awt::Key::DELETE;
+ break;
case GDK_KEY_Return:
nKeyCode = com::sun::star::awt::Key::RETURN;
break;
commit 173249da1fe4e2dd854cf18a47bd19cccae4a640
Author: Pranav Kant <pranavk at gnome.org>
Date: Tue Jun 23 14:37:09 2015 +0530
tilebuffer: Add timer to measure paintTile() call
Change-Id: I2645863c7445e17d77e2c4e2dc24e22f8685034e
diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx
index 3f22f98..60aa16f 100644
--- a/libreofficekit/source/gtk/tilebuffer.cxx
+++ b/libreofficekit/source/gtk/tilebuffer.cxx
@@ -91,7 +91,7 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom)
aTileRectangle.x = pixelToTwip(nTileSizePixels, aZoom) * y;
aTileRectangle.y = pixelToTwip(nTileSizePixels, aZoom) * x;
- g_info ("Rendering (%d, %d)", x, y);
+ g_test_timer_start();
m_pLOKDocument->pClass->paintTile(m_pLOKDocument,
pBuffer,
nTileSizePixels, nTileSizePixels,
@@ -99,6 +99,9 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom)
pixelToTwip(nTileSizePixels, aZoom),
pixelToTwip(nTileSizePixels, aZoom));
+ double elapsedTime = g_test_timer_elapsed();
+ g_info ("Rendered (%d, %d) in %f seconds", x, y, elapsedTime);
+
//create a mapping for it
m_mTiles[index].setPixbuf(pPixBuf);
m_mTiles[index].valid = true;
commit cbecaeb5fb225e1b7db13ef0041d945982a51be1
Author: Pranav Kant <pranavk at gnome.org>
Date: Tue Jun 23 02:58:38 2015 +0530
lokdocview: Remove superfluous *_post_key()
Instead directly let LOKDocView handle the input.
Change-Id: I260a460df23c3e2e5c78d8b363bb864ae5c63dab
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index 3a1628b..962f9d9 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -74,10 +74,6 @@ void lok_doc_view_post_command (LOKDocView*
const char* pCommand,
const char* pArguments);
-/// Posts a keyboard event to LibreOfficeKit.
-void lok_doc_view_post_key (LOKDocView* pDocView,
- GdkEvent* pEvent);
-
float lok_doc_view_pixel_to_twip (LOKDocView* pDocView,
float fInput);
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 1ca9454..db465cb 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -191,19 +191,6 @@ static void getVisibleAreaTwips(GdkRectangle* pArea)
#endif
}
-
-/// Handles the key-press-event of the window.
-static gboolean signalKey(GtkWidget* /*pWidget*/, GdkEvent* pEvent, gpointer/* pData*/)
-{
- LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView);
- if (!gtk_widget_get_visible(pFindbar) && bool(lok_doc_view_get_edit(pLOKDocView)))
- {
- lok_doc_view_post_key(pLOKDocView, pEvent);
- return TRUE;
- }
- return FALSE;
-}
-
/// Searches for the next or previous text of pFindbarEntry.
static void doSearch(bool bBackwards)
{
@@ -541,10 +528,6 @@ int main( int argc, char* argv[] )
g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL);
g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL);
- // Input handling.
- g_signal_connect(pWindow, "key-press-event", G_CALLBACK(signalKey), pDocView);
- g_signal_connect(pWindow, "key-release-event", G_CALLBACK(signalKey), pDocView);
-
// Scrolled window for DocView
pScrolledWindow = gtk_scrolled_window_new(0, 0);
gtk_widget_set_hexpand (pScrolledWindow, TRUE);
@@ -568,6 +551,11 @@ int main( int argc, char* argv[] )
g_signal_connect(G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0);
g_signal_connect(G_OBJECT(pPartSelector), "changed", G_CALLBACK(changePart), 0);
+ // Make only LOKDocView widget as focussable
+ GList *focusChain = NULL;
+ focusChain = g_list_append( focusChain, pDocView );
+ gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain );
+
gtk_main();
return 0;
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 988397a..ca7167b 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -226,24 +226,21 @@ isEmptyRectangle(const GdkRectangle& rRectangle)
return rRectangle.x == 0 && rRectangle.y == 0 && rRectangle.width == 0 && rRectangle.height == 0;
}
-static void
-signalKey (LOKDocView* pDocView, const GdkEvent* pEvent)
+static gboolean
+signalKey (GtkWidget* pWidget, GdkEventKey* pEvent)
{
+ LOKDocView* pDocView = LOK_DOC_VIEW(pWidget);
LOKDocViewPrivate* priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
int nCharCode = 0;
int nKeyCode = 0;
- guint keyval;
- GdkModifierType state;
- gdk_event_get_keyval (pEvent, &keyval);
- gdk_event_get_state (pEvent, &state);
if (!priv->m_bEdit)
{
g_info("signalKey: not in edit mode, ignore");
- return;
+ return FALSE;
}
- switch (keyval)
+ switch (pEvent->keyval)
{
case GDK_KEY_BackSpace:
nKeyCode = com::sun::star::awt::Key::BACKSPACE;
@@ -270,22 +267,24 @@ signalKey (LOKDocView* pDocView, const GdkEvent* pEvent)
nKeyCode = com::sun::star::awt::Key::RIGHT;
break;
default:
- if (keyval >= GDK_KEY_F1 && keyval <= GDK_KEY_F26)
- nKeyCode = com::sun::star::awt::Key::F1 + (keyval - GDK_KEY_F1);
+ if (pEvent->keyval >= GDK_KEY_F1 && pEvent->keyval <= GDK_KEY_F26)
+ nKeyCode = com::sun::star::awt::Key::F1 + (pEvent->keyval - GDK_KEY_F1);
else
- nCharCode = gdk_keyval_to_unicode(keyval);
+ nCharCode = gdk_keyval_to_unicode(pEvent->keyval);
}
// rsc is not public API, but should be good enough for debugging purposes.
// If this is needed for real, then probably a new param of type
// css::awt::KeyModifier is needed in postKeyEvent().
- if (state & GDK_SHIFT_MASK)
+ if (pEvent->state & GDK_SHIFT_MASK)
nKeyCode |= KEY_SHIFT;
if (pEvent->type == GDK_KEY_RELEASE)
priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, LOK_KEYEVENT_KEYUP, nCharCode, nKeyCode);
else
priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, LOK_KEYEVENT_KEYINPUT, nCharCode, nKeyCode);
+
+ return FALSE;
}
static gboolean
@@ -1151,6 +1150,8 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
pWidgetClass->draw = lok_doc_view_draw;
pWidgetClass->button_press_event = lok_doc_view_signal_button;
pWidgetClass->button_release_event = lok_doc_view_signal_button;
+ pWidgetClass->key_press_event = signalKey;
+ pWidgetClass->key_release_event = signalKey;
pWidgetClass->motion_notify_event = lok_doc_view_signal_motion;
/**
@@ -1431,6 +1432,8 @@ lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath)
gtk_widget_set_size_request(GTK_WIDGET(pDocView),
nDocumentWidthPixels,
nDocumentHeightPixels);
+ gtk_widget_set_can_focus(GTK_WIDGET(pDocView), TRUE);
+ gtk_widget_grab_focus(GTK_WIDGET(pDocView));
}
return TRUE;
}
@@ -1579,19 +1582,6 @@ lok_doc_view_post_command (LOKDocView* pDocView,
}
/**
- * lok_doc_view_post_key:
- * @pDocView: the #LOKDocView instance
- * @pEvent: the #GdkEventKey containing information about the event
- *
- * This methods forwards your key events to the LO core.
-*/
-SAL_DLLPUBLIC_EXPORT void
-lok_doc_view_post_key (LOKDocView* pDocView, GdkEvent* pEvent)
-{
- signalKey(pDocView, pEvent);
-}
-
-/**
* lok_doc_view_pixel_to_twip:
* @pDocView: The #LOKDocView instance
* @fInput: The value in pixels to convert to twips
commit 6ae73bc407131f703747f72ac12927a69cc41c5e
Author: Pranav Kant <pranavk at gnome.org>
Date: Tue Jun 23 01:52:44 2015 +0530
lokdocview: Don't handle hyperlink clicks
Instead emit the signal 'hyperlink-clicked', and let the
application decide how it wants to handle the hyperlink clicks.
Change-Id: Ief72bbd16727e140cacf28b852ad43952c02f7ae
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 917b294..1ca9454 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -312,6 +312,17 @@ static void signalPart(LOKDocView* /*pLOKDocView*/, int nPart, gpointer /*pData*
}
/// User clicked on a command button -> inform LOKDocView.
+static void signalHyperlink(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer /*pData*/)
+{
+ GError* pError = NULL;
+ gtk_show_uri(NULL, pPayload, GDK_CURRENT_TIME, &pError);
+ if (pError != NULL)
+ {
+ g_warning("Unable to show URI %s : %s", pPayload, pError->message);
+ g_error_free(pError);
+ }
+}
+
static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/)
{
if (g_bToolItemBroadcast)
@@ -528,6 +539,7 @@ int main( int argc, char* argv[] )
g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL);
g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL);
g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL);
+ g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL);
// Input handling.
g_signal_connect(pWindow, "key-press-event", G_CALLBACK(signalKey), pDocView);
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index cff02ea..988397a 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -324,6 +324,12 @@ setPart(LOKDocView* pDocView, const std::string& rString)
g_signal_emit(pDocView, doc_view_signals[PART_CHANGED], 0, std::stoi(rString));
}
+static void
+hyperlinkClicked(LOKDocView* pDocView, const std::string& rString)
+{
+ g_signal_emit(pDocView, doc_view_signals[HYPERLINK_CLICKED], 0, rString.c_str());
+}
+
/// Implementation of the global callback handler, invoked by globalCallback();
static gboolean
globalCallback (gpointer pData)
@@ -507,8 +513,7 @@ callback (gpointer pData)
break;
case LOK_CALLBACK_HYPERLINK_CLICKED:
{
- GError* pError = NULL;
- gtk_show_uri(NULL, pCallback->m_aPayload.c_str(), GDK_CURRENT_TIME, &pError);
+ hyperlinkClicked(pDocView, pCallback->m_aPayload);
}
break;
case LOK_CALLBACK_STATE_CHANGED:
@@ -1353,7 +1358,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
* @aHyperlink: the URI which the application should handle
*/
doc_view_signals[HYPERLINK_CLICKED] =
- g_signal_new("hyperlinked-clicked",
+ g_signal_new("hyperlink-clicked",
G_TYPE_FROM_CLASS(pGObjectClass),
G_SIGNAL_RUN_FIRST,
0,
commit 7153fcb7c4a76d30d9ccc3303c1498dff79649b9
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sun Jun 14 13:47:56 2015 +0200
SfxSimpleHint only needs a sal_uInt32 for the hint
Change-Id: I7f7f99ba93d4f06575228e62f96703fd2c54c469
Reviewed-on: https://gerrit.libreoffice.org/16271
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/svl/smplhint.hxx b/include/svl/smplhint.hxx
index 5c0c7ed..bdf9800 100644
--- a/include/svl/smplhint.hxx
+++ b/include/svl/smplhint.hxx
@@ -49,10 +49,10 @@
class SVL_DLLPUBLIC SfxSimpleHint: public SfxHint
{
private:
- sal_uLong mnId;
+ sal_uInt32 mnId;
public:
- SfxSimpleHint( sal_uLong nId ) { mnId = nId; }
- sal_uLong GetId() const { return mnId; }
+ SfxSimpleHint( sal_uInt32 nId ) { mnId = nId; }
+ sal_uInt32 GetId() const { return mnId; }
};
#endif
diff --git a/include/unotools/syslocaleoptions.hxx b/include/unotools/syslocaleoptions.hxx
index a41d7ec..cd62d85 100644
--- a/include/unotools/syslocaleoptions.hxx
+++ b/include/unotools/syslocaleoptions.hxx
@@ -30,12 +30,12 @@
#include <unotools/options.hxx>
// bits for broadcasting hints of changes in a SfxSimpleHint, may be combined
-const sal_uLong SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001;
-const sal_uLong SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002;
-const sal_uLong SYSLOCALEOPTIONS_HINT_UILOCALE = 0x00000004;
-const sal_uLong SYSLOCALEOPTIONS_HINT_DECSEP = 0x00000008;
-const sal_uLong SYSLOCALEOPTIONS_HINT_DATEPATTERNS = 0x00000010;
-const sal_uLong SYSLOCALEOPTIONS_HINT_IGNORELANG = 0x00000020;
+const sal_uInt32 SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001;
+const sal_uInt32 SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002;
+const sal_uInt32 SYSLOCALEOPTIONS_HINT_UILOCALE = 0x00000004;
+const sal_uInt32 SYSLOCALEOPTIONS_HINT_DECSEP = 0x00000008;
+const sal_uInt32 SYSLOCALEOPTIONS_HINT_DATEPATTERNS = 0x00000010;
+const sal_uInt32 SYSLOCALEOPTIONS_HINT_IGNORELANG = 0x00000020;
class SvtSysLocaleOptions_Impl;
class SvtListener;
commit ea1ea3b910dea72c901cd655af9a3abd501f4e60
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jun 29 09:14:05 2015 +0200
SwFrm::PrepareMake: use vcl::RenderContext
Change-Id: I34306bb1622c79489eb647ed45f398ad2634c144
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index f971809..834b042 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -370,7 +370,7 @@ protected:
void setRootFrm( SwRootFrm* pRoot ) { mpRoot = pRoot; }
SwPageFrm *InsertPage( SwPageFrm *pSibling, bool bFootnote );
- void PrepareMake();
+ void PrepareMake(vcl::RenderContext* pRenderContext);
void OptPrepareMake();
void MakePos();
// Format next frame of table frame to assure keeping attributes.
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index f08f956..7a29307 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -238,7 +238,7 @@ static bool lcl_IsCalcUpperAllowed( const SwFrm& rFrm )
*
* @see MakeAll()
*/
-void SwFrm::PrepareMake()
+void SwFrm::PrepareMake(vcl::RenderContext* pRenderContext)
{
StackHack aHack;
if ( GetUpper() )
@@ -274,7 +274,7 @@ void SwFrm::PrepareMake()
const SwTextFrm* pMaster = static_cast<SwContentFrm*>(this)->FindMaster();
if ( pMaster && pMaster->IsLocked() )
{
- MakeAll(IsRootFrm() ? 0 : getRootFrm()->GetCurrShell()->GetOut());
+ MakeAll(pRenderContext);
return;
}
}
@@ -303,7 +303,7 @@ void SwFrm::PrepareMake()
(SwFlowFrm::CastFlowFrm(pFrm))->IsAnFollow( pThis ) )
break;
- pFrm->MakeAll(IsRootFrm() ? 0 : getRootFrm()->GetCurrShell()->GetOut());
+ pFrm->MakeAll(pRenderContext);
if( IsSctFrm() && !static_cast<SwSectionFrm*>(this)->GetSection() )
break;
}
@@ -337,7 +337,7 @@ void SwFrm::PrepareMake()
if ( bTab && !bOldTabLock )
::PrepareUnlock( static_cast<SwTabFrm*>(this) );
}
- MakeAll(IsRootFrm() ? 0 : getRootFrm()->GetCurrShell()->GetOut());
+ MakeAll(pRenderContext);
}
void SwFrm::OptPrepareMake()
@@ -354,7 +354,7 @@ void SwFrm::OptPrepareMake()
return;
}
if ( GetPrev() && !GetPrev()->IsValid() )
- PrepareMake();
+ PrepareMake(getRootFrm()->GetCurrShell() ? getRootFrm()->GetCurrShell()->GetOut() : 0);
else
{
StackHack aHack;
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 2337950..b28041c 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2657,7 +2657,7 @@ SwFlyFrameFormat * SwFlyFrm::GetFormat()
void SwFlyFrm::Calc() const
{
if ( !m_bValidContentPos )
- const_cast<SwFlyFrm*>(this)->PrepareMake();
+ const_cast<SwFlyFrm*>(this)->PrepareMake(getRootFrm()->GetCurrShell() ? getRootFrm()->GetCurrShell()->GetOut() : 0);
else
SwLayoutFrm::Calc();
}
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 7a124c5..552a171 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1789,7 +1789,7 @@ bool SwFrm::OnFirstPage() const
void SwFrm::Calc() const
{
if ( !mbValidPos || !mbValidPrtArea || !mbValidSize )
- const_cast<SwFrm*>(this)->PrepareMake();
+ const_cast<SwFrm*>(this)->PrepareMake(getRootFrm()->GetCurrShell() ? getRootFrm()->GetCurrShell()->GetOut() : 0);
}
Point SwFrm::GetRelPos() const
commit 533e97947d82f780d5b1b7a02138d738b2435a56
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jun 29 09:13:36 2015 +0200
sw: outline SwFrm::Calc()
Change-Id: I9c59116828585c9645bc415ef5fffe65a24d09ee
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 9677a5f..f971809 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -998,11 +998,6 @@ inline void SwFrm::InvalidateNextPos( bool bNoFootnote )
ImplInvalidateNextPos( bNoFootnote );
}
-inline void SwFrm::Calc() const
-{
- if ( !mbValidPos || !mbValidPrtArea || !mbValidSize )
- const_cast<SwFrm*>(this)->PrepareMake();
-}
inline void SwFrm::OptCalc() const
{
if ( !mbValidPos || !mbValidPrtArea || !mbValidSize )
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 20fbfa9..7a124c5 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1786,6 +1786,12 @@ bool SwFrm::OnFirstPage() const
return bRet;
}
+void SwFrm::Calc() const
+{
+ if ( !mbValidPos || !mbValidPrtArea || !mbValidSize )
+ const_cast<SwFrm*>(this)->PrepareMake();
+}
+
Point SwFrm::GetRelPos() const
{
Point aRet( maFrm.Pos() );
commit 9c330da6784fe7982e5dc78203f0c886054f0174
Author: danlrobertson <danlrobertson89 at gmail.com>
Date: Sat Jun 27 00:40:54 2015 -0400
tdf#91055 Pass by Address - lcl_createWindowInfo
lcl_createWindowInfo now takes a pointer. In addition, a temporary
pointer and if statement in the funcitons while loop was used
in favor of a temporary pointer used throughout the function. There
should be no side effects due to this change. The change is largely
cosmetic.
Change-Id: Ib5be6f792c4120c0e0b51562ba541b98a011c49e
Reviewed-on: https://gerrit.libreoffice.org/16537
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b1f0eb8..6c221480 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -112,23 +112,33 @@ Window::Window( vcl::Window* pParent, const ResId& rResId )
#if OSL_DEBUG_LEVEL > 0
namespace
{
- OString lcl_createWindowInfo(const vcl::Window& i_rWindow)
- {
- // skip border windows, they don't carry information which helps diagnosing the problem
- const vcl::Window* pWindow( &i_rWindow );
- while ( pWindow && ( pWindow->GetType() == WINDOW_BORDERWINDOW ) )
- pWindow = pWindow->GetWindow( GetWindowType::FirstChild );
- if ( !pWindow )
- pWindow = &i_rWindow;
-
- OStringBuffer aErrorString;
- aErrorString.append(' ');
- aErrorString.append(typeid( *pWindow ).name());
- aErrorString.append(" (");
- aErrorString.append(OUStringToOString(pWindow->GetText(), RTL_TEXTENCODING_UTF8));
- aErrorString.append(")");
- return aErrorString.makeStringAndClear();
- }
+ OString lcl_createWindowInfo(const vcl::Window* pWindow)
+ {
+ // skip border windows, they do not carry information that
+ // would help with diagnosing the problem
+ const vcl::Window* pTempWin( pWindow );
+ while ( pTempWin && pTempWin->GetType() == WINDOW_BORDERWINDOW ) {
+ pTempWin = pTempWin->GetWindow( GetWindowType::FirstChild );
+ }
+ // check if pTempWin is not null, otherwise use the
+ // original address
+ if ( pTempWin ) {
+ pWindow = pTempWin;
+ }
+
+ OStringBuffer aErrorString;
+ aErrorString.append(' ');
+ aErrorString.append(typeid( *pWindow ).name());
+ aErrorString.append("(");
+ aErrorString.append(
+ OUStringToOString(
+ pWindow->GetText(),
+ RTL_TEXTENCODING_UTF8
+ )
+ );
+ aErrorString.append(")");
+ return aErrorString.makeStringAndClear();
+ }
}
#endif
@@ -260,12 +270,12 @@ void Window::dispose()
if ( mpWindowImpl->mpFirstChild )
{
OStringBuffer aTempStr("Window (");
- aTempStr.append(lcl_createWindowInfo(*this));
+ aTempStr.append(lcl_createWindowInfo(this));
aTempStr.append(") with live children destroyed: ");
pTempWin = mpWindowImpl->mpFirstChild;
while ( pTempWin )
{
- aTempStr.append(lcl_createWindowInfo(*pTempWin));
+ aTempStr.append(lcl_createWindowInfo(pTempWin));
pTempWin = pTempWin->mpWindowImpl->mpNext;
}
OSL_FAIL( aTempStr.getStr() );
@@ -280,7 +290,7 @@ void Window::dispose()
if ( ImplIsRealParentPath( pTempWin ) )
{
bError = true;
- aErrorStr.append(lcl_createWindowInfo(*pTempWin));
+ aErrorStr.append(lcl_createWindowInfo(pTempWin));
}
pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
}
@@ -288,7 +298,7 @@ void Window::dispose()
{
OStringBuffer aTempStr;
aTempStr.append("Window (");
- aTempStr.append(lcl_createWindowInfo(*this));
+ aTempStr.append(lcl_createWindowInfo(this));
aTempStr.append(") with live SystemWindows destroyed: ");
aTempStr.append(aErrorStr.toString());
OSL_FAIL(aTempStr.getStr());
@@ -305,14 +315,14 @@ void Window::dispose()
if ( ImplIsRealParentPath( pTempWin ) )
{
bError = true;
- aErrorStr.append(lcl_createWindowInfo(*pTempWin));
+ aErrorStr.append(lcl_createWindowInfo(pTempWin));
}
pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame;
}
if ( bError )
{
OStringBuffer aTempStr( "Window (" );
- aTempStr.append(lcl_createWindowInfo(*this));
+ aTempStr.append(lcl_createWindowInfo(this));
aTempStr.append(") with live SystemWindows destroyed: ");
aTempStr.append(aErrorStr.toString());
OSL_FAIL( aTempStr.getStr() );
@@ -322,12 +332,12 @@ void Window::dispose()
if ( mpWindowImpl->mpFirstOverlap )
{
OStringBuffer aTempStr("Window (");
- aTempStr.append(lcl_createWindowInfo(*this));
+ aTempStr.append(lcl_createWindowInfo(this));
aTempStr.append(") with live SystemWindows destroyed: ");
pTempWin = mpWindowImpl->mpFirstOverlap;
while ( pTempWin )
{
- aTempStr.append(lcl_createWindowInfo(*pTempWin));
+ aTempStr.append(lcl_createWindowInfo(pTempWin));
pTempWin = pTempWin->mpWindowImpl->mpNext;
}
OSL_FAIL( aTempStr.getStr() );
@@ -348,7 +358,7 @@ void Window::dispose()
if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) )
{
OStringBuffer aTempStr("Window (");
- aTempStr.append(lcl_createWindowInfo(*this));
+ aTempStr.append(lcl_createWindowInfo(this));
aTempStr.append(") still in TaskPanelList!");
OSL_FAIL( aTempStr.getStr() );
Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed!
commit 497c589802a788de78af28ea88cec947b25355b3
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Tue Jun 16 14:36:06 2015 +0200
sal_uLong->sal_Int32 in SvtIconChoiceCtrl
and drop the pass-by-reference param from GetSelected, nothing
uses it
Change-Id: I6d616a2b147912af9305410625af6e7afae34e59
Reviewed-on: https://gerrit.libreoffice.org/16312
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx
index 1d512aa..4847b25 100644
--- a/accessibility/source/extended/accessibleiconchoicectrl.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrl.cxx
@@ -96,8 +96,7 @@ namespace accessibility
SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() );
if ( pEntry == NULL )
{
- sal_uLong nPos=0;
- pEntry = getCtrl()->GetSelectedEntry ( nPos );
+ pEntry = getCtrl()->GetSelectedEntry();
}
if ( pEntry )
{
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index 6e800d2..bf90a98 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -250,9 +250,9 @@ void IconChoiceDialog::dispose()
if (m_pIconCtrl)
{
// remove Userdata from Icons
- for ( sal_uLong i=0; i < m_pIconCtrl->GetEntryCount(); i++)
+ for ( sal_Int32 i=0; i < m_pIconCtrl->GetEntryCount(); i++)
{
- SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry ( i );
+ SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( i );
delete static_cast<sal_uInt16*>(pEntry->GetUserData());
}
}
@@ -358,13 +358,11 @@ void IconChoiceDialog::ShowPage(sal_uInt16 nId)
\**********************************************************************/
IMPL_LINK_NOARG(IconChoiceDialog , ChosePageHdl_Impl)
{
- sal_uLong nPos;
-
- SvxIconChoiceCtrlEntry *pEntry = m_pIconCtrl->GetSelectedEntry ( nPos );
+ SvxIconChoiceCtrlEntry *pEntry = m_pIconCtrl->GetSelectedEntry();
if ( !pEntry )
pEntry = m_pIconCtrl->GetCursor( );
- sal_uInt16 *pId = static_cast<sal_uInt16*>(pEntry->GetUserData ());
+ sal_uInt16 *pId = static_cast<sal_uInt16*>(pEntry->GetUserData());
if( *pId != mnCurrentPageId )
{
@@ -841,7 +839,7 @@ short IconChoiceDialog::Ok()
void IconChoiceDialog::FocusOnIcon( sal_uInt16 nId )
{
// set focus to icon for the current visible page
- for ( sal_uLong i=0; i<m_pIconCtrl->GetEntryCount(); i++)
+ for ( sal_Int32 i=0; i<m_pIconCtrl->GetEntryCount(); i++)
{
SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry ( i );
sal_uInt16* pUserData = static_cast<sal_uInt16*>(pEntry->GetUserData());
diff --git a/dbaccess/source/ui/app/AppSwapWindow.cxx b/dbaccess/source/ui/app/AppSwapWindow.cxx
index d365473..b7ddc15 100644
--- a/dbaccess/source/ui/app/AppSwapWindow.cxx
+++ b/dbaccess/source/ui/app/AppSwapWindow.cxx
@@ -114,8 +114,7 @@ void OApplicationSwapWindow::DataChanged( const DataChangedEvent& rDCEvt )
void OApplicationSwapWindow::clearSelection()
{
m_aIconControl->SetNoSelection();
- sal_uLong nPos = 0;
- SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry(nPos);
+ SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry();
if ( pEntry )
m_aIconControl->InvalidateEntry(pEntry);
m_aIconControl->GetClickHdl().Call(m_aIconControl.get());
@@ -138,8 +137,7 @@ bool OApplicationSwapWindow::interceptKeyInput( const KeyEvent& _rEvent )
ElementType OApplicationSwapWindow::getElementType() const
{
- sal_uLong nPos = 0;
- SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry(nPos);
+ SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry();
return ( pEntry ) ? *static_cast<ElementType*>(pEntry->GetUserData()) : E_NONE;
}
@@ -161,8 +159,7 @@ bool OApplicationSwapWindow::onContainerSelected( ElementType _eType )
IMPL_LINK(OApplicationSwapWindow, OnContainerSelectHdl, SvtIconChoiceCtrl*, _pControl)
{
- sal_uLong nPos = 0;
- SvxIconChoiceCtrlEntry* pEntry = _pControl->GetSelectedEntry( nPos );
+ SvxIconChoiceCtrlEntry* pEntry = _pControl->GetSelectedEntry();
ElementType eType = E_NONE;
if ( pEntry )
{
diff --git a/dbaccess/source/ui/app/AppSwapWindow.hxx b/dbaccess/source/ui/app/AppSwapWindow.hxx
index b655dd8..077bc165 100644
--- a/dbaccess/source/ui/app/AppSwapWindow.hxx
+++ b/dbaccess/source/ui/app/AppSwapWindow.hxx
@@ -56,7 +56,7 @@ namespace dbaui
void cut() SAL_OVERRIDE { }
void paste() SAL_OVERRIDE { }
- inline sal_uLong GetEntryCount() const { return m_aIconControl->GetEntryCount(); }
+ inline sal_Int32 GetEntryCount() const { return m_aIconControl->GetEntryCount(); }
inline SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const { return m_aIconControl->GetEntry(nPos); }
inline Rectangle GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const { return m_aIconControl->GetBoundingBox(pEntry); }
diff --git a/include/svtools/ivctrl.hxx b/include/svtools/ivctrl.hxx
index ad8b30a..baa02a0 100644
--- a/include/svtools/ivctrl.hxx
+++ b/include/svtools/ivctrl.hxx
@@ -82,7 +82,7 @@ class SvxIconChoiceCtrlEntry
Rectangle aRect; // Bounding-Rect of the entry
Rectangle aGridRect; // Only valid in Grid-mode
- sal_uLong nPos;
+ sal_Int32 nPos;
/*
The insert position in the Insertlist is equal to the (sort) order stated at the Insert
@@ -148,8 +148,6 @@ public:
// Only set at AutoArrange. The head of the list is accessible via SvxIconChoiceCtrl::GetPredecessorHead
SvxIconChoiceCtrlEntry* GetSuccessor() const { return pflink; }
SvxIconChoiceCtrlEntry* GetPredecessor() const { return pblink; }
-
-// sal_Unicode GetMnemonicChar() const;
};
enum SvxIconChoiceCtrlColumnAlign
@@ -307,9 +305,9 @@ public:
bool IsEntryEditing() const;
- sal_uLong GetEntryCount() const;
- SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const;
- sal_uLong GetEntryListPos( SvxIconChoiceCtrlEntry* pEntry ) const;
+ sal_Int32 GetEntryCount() const;
+ SvxIconChoiceCtrlEntry* GetEntry( sal_Int32 nPos ) const;
+ sal_Int32 GetEntryListPos( SvxIconChoiceCtrlEntry* pEntry ) const;
using Window::SetCursor;
void SetCursor( SvxIconChoiceCtrlEntry* pEntry );
SvxIconChoiceCtrlEntry* GetCursor() const;
@@ -322,10 +320,10 @@ public:
SvxIconChoiceCtrlEntry* GetEntry( const Point& rPosPixel, bool bHit = false ) const;
// sal_uLong is the position of the selected element in the list
- SvxIconChoiceCtrlEntry* GetSelectedEntry( sal_uLong& rPos ) const;
+ SvxIconChoiceCtrlEntry* GetSelectedEntry() const;
#ifdef DBG_UTIL
- void SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry = 0 );
+ void SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry = 0 );
#endif
void SetFontColorToBackground ( bool bDo = true ) { _bAutoFontColor = bDo; }
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx
index 73d1930..bb368f5 100644
--- a/svtools/source/contnr/imivctl.hxx
+++ b/svtools/source/contnr/imivctl.hxx
@@ -211,7 +211,7 @@ class SvxIconChoiceCtrl_Impl
SvxIconChoiceCtrlEntry* pCurEditedEntry;
SvxIconChoiceCtrlTextMode eTextMode;
SelectionMode eSelectionMode;
- sal_uLong nSelectionCount;
+ sal_Int32 nSelectionCount;
SvxIconChoiceCtrlPositionMode ePositionMode;
bool bBoundRectsDirty;
bool bUpdateMode;
@@ -438,7 +438,7 @@ public:
void Command( const CommandEvent& rCEvt );
void ToTop( SvxIconChoiceCtrlEntry* );
- sal_uLong GetSelectionCount() const;
+ sal_Int32 GetSelectionCount() const;
void SetGrid( const Size& );
Size GetMinGrid() const;
void Scroll( long nDeltaX, long nDeltaY, bool bScrollBar = false );
@@ -457,7 +457,7 @@ public:
std::vector<Rectangle*>* pOtherRects = 0
);
- bool IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos );
+ bool IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos );
void MakeVisible(
const Rectangle& rDocPos,
bool bInScrollBarEvent=false,
@@ -485,7 +485,7 @@ public:
{
return aEntries[ nPos ];
}
- SvxIconChoiceCtrlEntry* GetFirstSelectedEntry( sal_uLong& ) const;
+ SvxIconChoiceCtrlEntry* GetFirstSelectedEntry() const;
SvxIconChoiceCtrlEntry* GetHdlEntry() const { return pHdlEntry; }
void SetHdlEntry( SvxIconChoiceCtrlEntry* pEntry ) { pHdlEntry = pEntry; }
@@ -500,7 +500,7 @@ public:
else
nFlags &= ~(F_MOVED_ENTRIES);
}
- sal_uLong GetEntryListPos( SvxIconChoiceCtrlEntry* ) const;
+ sal_Int32 GetEntryListPos( SvxIconChoiceCtrlEntry* ) const;
void SetEntryImageSize( const Size& rSize ) { aImageSize = rSize; }
void InitSettings();
Rectangle GetOutputRect() const;
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 8449d5b..3aa1c23 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -641,9 +641,9 @@ void SvxIconChoiceCtrl_Impl::Paint(vcl::RenderContext& rRenderContext, const Rec
{
// set cursor to item with focus-flag
bool bfound = false;
- for (sal_uLong i = 0; i < pView->GetEntryCount() && !bfound; i++)
+ for (sal_Int32 i = 0; i < pView->GetEntryCount() && !bfound; i++)
{
- SvxIconChoiceCtrlEntry* pEntry = pView->GetEntry (i);
+ SvxIconChoiceCtrlEntry* pEntry = pView->GetEntry(i);
if (pEntry->IsFocused())
{
pCursor = pEntry;
@@ -2342,7 +2342,7 @@ void SvxIconChoiceCtrl_Impl::MakeVisible( const Rectangle& rRect, bool bScrBar,
VisRectChanged();
}
-sal_uLong SvxIconChoiceCtrl_Impl::GetSelectionCount() const
+sal_Int32 SvxIconChoiceCtrl_Impl::GetSelectionCount() const
{
if( (nWinBits & WB_HIGHLIGHTFRAME) && pCurHighlightFrame )
return 1;
@@ -3073,14 +3073,13 @@ void SvxIconChoiceCtrl_Impl::StopEntryEditing( bool bCancel )
pEdit->StopEditing( bCancel );
}
-SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong& rPos ) const
+SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry() const
{
if( !GetSelectionCount() )
return 0;
if( (nWinBits & WB_HIGHLIGHTFRAME) && (eSelectionMode == NO_SELECTION) )
{
- rPos = pView->GetEntryListPos( pCurHighlightFrame );
return pCurHighlightFrame;
}
@@ -3092,7 +3091,6 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong
SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
if( pEntry->IsSelected() )
{
- rPos = nCur;
return pEntry;
}
}
@@ -3104,7 +3102,6 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong
{
if( pEntry->IsSelected() )
{
- rPos = GetEntryListPos( pEntry );
return pEntry;
}
pEntry = pEntry->pflink;
@@ -3260,7 +3257,7 @@ void IcnViewEdit_Impl::StopEditing( bool bCancel )
}
}
-sal_uLong SvxIconChoiceCtrl_Impl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntry ) const
+sal_Int32 SvxIconChoiceCtrl_Impl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntry ) const
{
if( !(nFlags & F_ENTRYLISTPOS_VALID ))
const_cast<SvxIconChoiceCtrl_Impl*>(this)->SetListPositions();
diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx
index 5378693..73e5c5e 100644
--- a/svtools/source/contnr/ivctrl.cxx
+++ b/svtools/source/contnr/ivctrl.cxx
@@ -150,7 +150,7 @@ void SvtIconChoiceCtrl::ArrangeIcons()
Size aFullSize;
Rectangle aEntryRect;
- for ( sal_uLong i = 0; i < GetEntryCount(); i++ )
+ for ( sal_Int32 i = 0; i < GetEntryCount(); i++ )
{
SvxIconChoiceCtrlEntry* pEntry = GetEntry ( i );
aEntryRect = _pImp->GetEntryBoundRect ( pEntry );
@@ -165,7 +165,7 @@ void SvtIconChoiceCtrl::ArrangeIcons()
Size aFullSize;
Rectangle aEntryRect;
- for ( sal_uLong i = 0; i < GetEntryCount(); i++ )
+ for ( sal_Int32 i = 0; i < GetEntryCount(); i++ )
{
SvxIconChoiceCtrlEntry* pEntry = GetEntry ( i );
aEntryRect = _pImp->GetEntryBoundRect ( pEntry );
@@ -208,8 +208,7 @@ void SvtIconChoiceCtrl::GetFocus()
{
_pImp->GetFocus();
Control::GetFocus();
- sal_uLong nPos;
- SvxIconChoiceCtrlEntry* pSelectedEntry = GetSelectedEntry ( nPos );
+ SvxIconChoiceCtrlEntry* pSelectedEntry = GetSelectedEntry();
if ( pSelectedEntry )
_pImp->CallEventListeners( VCLEVENT_LISTBOX_SELECT, pSelectedEntry );
}
@@ -267,12 +266,12 @@ void SvtIconChoiceCtrl::SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIc
}
#endif
-sal_uLong SvtIconChoiceCtrl::GetEntryCount() const
+sal_Int32 SvtIconChoiceCtrl::GetEntryCount() const
{
return _pImp ? _pImp->GetEntryCount() : 0;
}
-SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetEntry( sal_uLong nPos ) const
+SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetEntry( sal_Int32 nPos ) const
{
return _pImp ? _pImp->GetEntry( nPos ) : NULL;
}
@@ -282,15 +281,14 @@ void SvtIconChoiceCtrl::CreateAutoMnemonics( MnemonicGenerator& _rUsedMnemonics
_pImp->CreateAutoMnemonics( &_rUsedMnemonics );
}
-SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetSelectedEntry( sal_uLong& rPos ) const
+SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetSelectedEntry() const
{
- return _pImp ? _pImp->GetFirstSelectedEntry( rPos ) : NULL;
+ return _pImp ? _pImp->GetFirstSelectedEntry() : NULL;
}
void SvtIconChoiceCtrl::ClickIcon()
{
- sal_uLong nPos;
- GetSelectedEntry ( nPos );
+ GetSelectedEntry();
_aClickIconHdl.Call( this );
}
bool SvtIconChoiceCtrl::IsEntryEditing() const
@@ -323,7 +321,7 @@ bool SvtIconChoiceCtrl::DoKeyInput( const KeyEvent& rKEvt )
_pCurKeyEvent = NULL;
return bHandled;
}
-sal_uLong SvtIconChoiceCtrl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntry ) const
+sal_Int32 SvtIconChoiceCtrl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntry ) const
{
return _pImp->GetEntryListPos( pEntry );
}
commit e57314f61f67b093510c5a8a8f34a62126ba8734
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sat May 16 11:12:48 2015 +0200
return and use std::vector from OInterfaceContainerHelper
since most of the time we don’t need a heavyweight uno::Sequence.
Adds a new method getElementsAsVector().
Change-Id: I9e72bef0c0c723ffd0dd7d4152db5baec6784a7a
Reviewed-on: https://gerrit.libreoffice.org/15747
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
Tested-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index e38dfce..31e3786 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -227,10 +227,9 @@ bool ChartModel::impl_isControllerConnected( const uno::Reference< frame::XContr
{
try
{
- uno::Sequence< uno::Reference<uno::XInterface> > aSeq = m_aControllers.getElements();
- for( sal_Int32 nN = aSeq.getLength(); nN--; )
+ for( uno::Reference<uno::XInterface> & rInterface : m_aControllers.getElements() )
{
- if( aSeq[nN] == xController )
+ if( rInterface == xController )
return true;
}
}
diff --git a/comphelper/source/misc/accessibleeventnotifier.cxx b/comphelper/source/misc/accessibleeventnotifier.cxx
index d8a3b36..224c44d 100644
--- a/comphelper/source/misc/accessibleeventnotifier.cxx
+++ b/comphelper/source/misc/accessibleeventnotifier.cxx
@@ -255,7 +255,7 @@ namespace comphelper
void AccessibleEventNotifier::addEvent( const TClientId _nClient, const AccessibleEventObject& _rEvent )
{
- Sequence< Reference< XInterface > > aListeners;
+ std::vector< Reference< XInterface > > aListeners;
// --- <mutex lock> -------------------------------
{
@@ -267,25 +267,22 @@ namespace comphelper
return;
// since we're synchronous, again, we want to notify immediately
- aListeners = aClientPos->second->getElements();
+ aListeners = aClientPos->second->getElementsAsVector();
}
// --- </mutex lock> ------------------------------
- // default handling: loop through all listeners, and notify them
- const Reference< XInterface >* pListeners = aListeners.getConstArray();
- const Reference< XInterface >* pListenersEnd = pListeners + aListeners.getLength();
- while ( pListeners != pListenersEnd )
+ // default handling: loop through all listeners, and notify them
+ for ( const Reference< XInterface > & rL : aListeners )
{
try
{
- static_cast< XAccessibleEventListener* >( pListeners->get() )->notifyEvent( _rEvent );
+ static_cast< XAccessibleEventListener* >( rL.get() )->notifyEvent( _rEvent );
}
catch( const Exception& )
{
// no assertion, because a broken access remote bridge or something like this
// can cause this exception
}
- ++pListeners;
}
}
diff --git a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx
index ff7c792..e98aab2 100644
--- a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx
+++ b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx
@@ -112,12 +112,11 @@ namespace cppu_ifcontainer
pContainer->addInterface(xRef);
aListeners.push_back(xRef);
}
- Sequence< Reference< XInterface > > aElements;
- aElements = pContainer->getElements();
+ std::vector< Reference< XInterface > > aElements = pContainer->getElementsAsVector();
CPPUNIT_ASSERT_MESSAGE("query contents",
- (int)aElements.getLength() == nTests);
- if ((int)aElements.getLength() == nTests)
+ (int)aElements.size() == nTests);
+ if ((int)aElements.size() == nTests)
{
for (i = 0; i < nTests; i++)
{
@@ -157,8 +156,8 @@ namespace cppu_ifcontainer
pHelper = pContainer->getContainer(pTypes[i]);
CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != NULL);
- Sequence<Reference< XInterface > > aSeq = pHelper->getElements();
- CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 2);
+ std::vector<Reference< XInterface > > aSeq = pHelper->getElementsAsVector();
+ CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.size() == 2);
CPPUNIT_ASSERT_MESSAGE("match", aSeq[0] == xRefs[i*2]);
CPPUNIT_ASSERT_MESSAGE("match", aSeq[1] == xRefs[i*2+1]);
}
@@ -175,8 +174,8 @@ namespace cppu_ifcontainer
pHelper = pContainer->getContainer(pTypes[i]);
CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != NULL);
- Sequence<Reference< XInterface > > aSeq = pHelper->getElements();
- CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 1);
+ std::vector<Reference< XInterface > > aSeq = pHelper->getElementsAsVector();
+ CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.size() == 1);
CPPUNIT_ASSERT_MESSAGE("match", aSeq[0] == xRefs[i*2]);
}
@@ -191,8 +190,8 @@ namespace cppu_ifcontainer
pHelper = pContainer->getContainer(pTypes[i]);
CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != NULL);
- Sequence<Reference< XInterface > > aSeq = pHelper->getElements();
- CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 0);
+ std::vector<Reference< XInterface > > aSeq = pHelper->getElementsAsVector();
+ CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.size() == 0);
}
delete pContainer;
diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map
index 12c29834a..1a15f35 100644
--- a/cppuhelper/source/gcc3.map
+++ b/cppuhelper/source/gcc3.map
@@ -430,6 +430,12 @@ global:
_ZN4cppu15supportsServiceEPN3com3sun4star4lang12XServiceInfoERKN3rtl8OUStringE; # cppu::supportsService(com::sun::star::lang::XServiceInfo*, rtl::OUString const&)
} UDK_3.8;
+
+PRIVATE_cppuhelper.1 { # LibreOffice 5.1
+ global:
+ _ZNK4cppu25OInterfaceContainerHelper19getElementsAsVectorEv; # std::vector< Reference<XInterface> > OInterfaceContainerHelper::getElementsAsVector() const
+};
+
# Unique libstdc++ symbols:
GLIBCXX_3.4 {
global:
diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx
index 5bd20a4..93a3836 100644
--- a/cppuhelper/source/interfacecontainer.cxx
+++ b/cppuhelper/source/interfacecontainer.cxx
@@ -28,6 +28,7 @@
#include <memory>
#include <com/sun/star/lang/XEventListener.hpp>
+#include <iterator>
using namespace osl;
@@ -36,32 +37,6 @@ using namespace com::sun::star::lang;
namespace cppu
{
-/**
- * Reallocate the sequence.
- */
-static void realloc( Sequence< Reference< XInterface > > & rSeq, sal_Int32 nNewLen )
-{
- rSeq.realloc( nNewLen );
-}
-
-/**
- * Remove an element from an interface sequence.
- */
-static void sequenceRemoveElementAt( Sequence< Reference< XInterface > > & rSeq, sal_Int32 index )
-{
- sal_Int32 nNewLen = rSeq.getLength() - 1;
-
- Sequence< Reference< XInterface > > aDestSeq( rSeq.getLength() - 1 );
- // getArray on a const sequence is faster
- const Reference< XInterface > * pSource = ((const Sequence< Reference< XInterface > > &)rSeq).getConstArray();
- Reference< XInterface > * pDest = aDestSeq.getArray();
- sal_Int32 i = 0;
- for( ; i < index; i++ )
- pDest[i] = pSource[i];
- for( sal_Int32 j = i ; j < nNewLen; j++ )
- pDest[j] = pSource[j+1];
- rSeq = aDestSeq;
-}
#ifdef _MSC_VER
#pragma warning( disable: 4786 )
@@ -79,7 +54,7 @@ OInterfaceIteratorHelper::OInterfaceIteratorHelper( OInterfaceContainerHelper &
if( bIsList )
{
rCont.bInUse = sal_True;
- nRemain = aData.pAsSequence->getLength();
+ nRemain = aData.pAsVector->size();
}
else if( aData.pAsInterface )
{
@@ -96,7 +71,7 @@ OInterfaceIteratorHelper::~OInterfaceIteratorHelper()
{
MutexGuard aGuard( rCont.rMutex );
// bResetInUse protect the iterator against recursion
- bShared = aData.pAsSequence == rCont.aData.pAsSequence && rCont.bIsList;
+ bShared = aData.pAsVector == rCont.aData.pAsVector && rCont.bIsList;
if( bShared )
{
OSL_ENSURE( rCont.bInUse, "OInterfaceContainerHelper must be in use" );
@@ -108,7 +83,7 @@ OInterfaceIteratorHelper::~OInterfaceIteratorHelper()
{
if( bIsList )
// Sequence owned by the iterator
- delete aData.pAsSequence;
+ delete aData.pAsVector;
else if( aData.pAsInterface )
// Interface is acquired by the iterator
aData.pAsInterface->release();
@@ -121,8 +96,7 @@ XInterface * OInterfaceIteratorHelper::next()
{
nRemain--;
if( bIsList )
- // typecase to const,so the getArray method is faster
- return aData.pAsSequence->getConstArray()[nRemain].get();
+ return (*aData.pAsVector)[nRemain].get();
else if( aData.pAsInterface )
return aData.pAsInterface;
}
@@ -135,8 +109,8 @@ void OInterfaceIteratorHelper::remove()
if( bIsList )
{
OSL_ASSERT( nRemain >= 0 &&
- nRemain < aData.pAsSequence->getLength() );
- XInterface * p = aData.pAsSequence->getConstArray()[nRemain].get();
+ nRemain < static_cast<sal_Int32>(aData.pAsVector->size()) );
+ XInterface * p = (*aData.pAsVector)[nRemain].get();
rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >( &p ) );
}
else
@@ -157,7 +131,7 @@ OInterfaceContainerHelper::~OInterfaceContainerHelper()
{
OSL_ENSURE( !bInUse, "~OInterfaceContainerHelper but is in use" );
if( bIsList )
- delete aData.pAsSequence;
+ delete aData.pAsVector;
else if( aData.pAsInterface )
aData.pAsInterface->release();
}
@@ -166,17 +140,30 @@ sal_Int32 OInterfaceContainerHelper::getLength() const
{
MutexGuard aGuard( rMutex );
if( bIsList )
- return aData.pAsSequence->getLength();
+ return aData.pAsVector->size();
else if( aData.pAsInterface )
return 1;
return 0;
}
-Sequence< Reference<XInterface> > OInterfaceContainerHelper::getElements() const
+std::vector< Reference<XInterface> > OInterfaceContainerHelper::getElementsAsVector() const
+{
+ MutexGuard aGuard( rMutex );
+ if( bIsList )
+ return *aData.pAsVector;
+ else if( aData.pAsInterface )
+ {
+ Reference<XInterface> x( aData.pAsInterface );
+ return { x };
+ }
+ return std::vector< Reference< XInterface > >();
+}
+
+css::uno::Sequence< Reference<XInterface> > OInterfaceContainerHelper::getElements() const
{
MutexGuard aGuard( rMutex );
if( bIsList )
- return *aData.pAsSequence;
+ return css::uno::Sequence< Reference<XInterface> >( aData.pAsVector->data(), static_cast<sal_Int32>(aData.pAsVector->size()) );
else if( aData.pAsInterface )
{
Reference<XInterface> x( aData.pAsInterface );
@@ -193,7 +180,7 @@ void OInterfaceContainerHelper::copyAndResetInUse()
// this should be the worst case. If a iterator is active
// and a new Listener is added.
if( bIsList )
- aData.pAsSequence = new Sequence< Reference< XInterface > >( *aData.pAsSequence );
+ aData.pAsVector = new std::vector< Reference< XInterface > >( *aData.pAsVector );
else if( aData.pAsInterface )
aData.pAsInterface->acquire();
@@ -210,19 +197,16 @@ sal_Int32 OInterfaceContainerHelper::addInterface( const Reference<XInterface> &
if( bIsList )
{
- sal_Int32 nLen = aData.pAsSequence->getLength();
- realloc( *aData.pAsSequence, nLen +1 );
- aData.pAsSequence->getArray()[ nLen ] = rListener;
- return nLen +1;
+ aData.pAsVector->push_back( rListener );
+ return aData.pAsVector->size();
}
else if( aData.pAsInterface )
{
- Sequence< Reference< XInterface > > * pSeq = new Sequence< Reference< XInterface > >( 2 );
- Reference<XInterface> * pArray = pSeq->getArray();
- pArray[0] = aData.pAsInterface;
- pArray[1] = rListener;
+ std::vector< Reference< XInterface > > * pSeq = new std::vector< Reference< XInterface > >( 2 );
+ (*pSeq)[0] = aData.pAsInterface;
+ (*pSeq)[1] = rListener;
aData.pAsInterface->release();
- aData.pAsSequence = pSeq;
+ aData.pAsVector = pSeq;
bIsList = sal_True;
return 2;
}
@@ -244,43 +228,41 @@ sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference<XInterface
if( bIsList )
{
- const Reference<XInterface> * pL = aData.pAsSequence->getConstArray();
- sal_Int32 nLen = aData.pAsSequence->getLength();
- sal_Int32 i;
- for( i = 0; i < nLen; i++ )
+ // It is not valid to compare the pointer directly, but it's faster.
+ bool bFound = false;
+ for( auto it = std::begin(*aData.pAsVector); it != std::end(*aData.pAsVector); ++it )
{
- // It is not valid to compare the pointer directly, but it's faster.
- if( pL[i].get() == rListener.get() )
+ if( (*it).get() == rListener.get() )
{
- sequenceRemoveElementAt( *aData.pAsSequence, i );
+ aData.pAsVector->erase(it);
+ bFound = true;
break;
}
}
-
- if( i == nLen )
+ if (!bFound)
{
// interface not found, use the correct compare method
- for( i = 0; i < nLen; i++ )
+ for( auto it = std::begin(*aData.pAsVector); it != std::end(*aData.pAsVector); ++it )
{
- if( pL[i] == rListener )
+ if( *it == rListener )
{
- sequenceRemoveElementAt(*aData.pAsSequence, i );
+ aData.pAsVector->erase(it);
break;
}
}
}
- if( aData.pAsSequence->getLength() == 1 )
+ if( aData.pAsVector->size() == 1 )
{
- XInterface * p = aData.pAsSequence->getConstArray()[0].get();
+ XInterface * p = (*aData.pAsVector)[0].get();
p->acquire();
- delete aData.pAsSequence;
+ delete aData.pAsVector;
aData.pAsInterface = p;
bIsList = sal_False;
return 1;
}
else
- return aData.pAsSequence->getLength();
+ return aData.pAsVector->size();
}
else if( aData.pAsInterface && Reference<XInterface>( aData.pAsInterface ) == rListener )
{
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index f1723a9..8220327 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -104,22 +104,15 @@ com_sun_star_comp_dba_ORowSet_get_implementation(css::uno::XComponentContext* co
}
#define NOTIFY_LISTERNERS_CHECK(_rListeners,T,method) \
- Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \
- \
- const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray(); \
- const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \
+ std::vector< Reference< XInterface > > aListenerSeq = _rListeners.getElementsAsVector(); \
\
_rGuard.clear(); \
bool bCheck = true; \
- while( pxInt > pxIntBegin && bCheck ) \
+ for( auto iter = aListenerSeq.rbegin(); iter != aListenerSeq.rend() && bCheck; ++iter ) \
{ \
try \
{ \
- while( pxInt > pxIntBegin && bCheck ) \
- { \
- --pxInt; \
- bCheck = static_cast< T* >( pxInt->get() )->method(aEvt); \
- } \
+ bCheck = static_cast< T* >( (*iter).get() )->method(aEvt); \
} \
catch( RuntimeException& ) \
{ \
diff --git a/dbaccess/source/inc/apitools.hxx b/dbaccess/source/inc/apitools.hxx
index 6672420..583fff3 100644
--- a/dbaccess/source/inc/apitools.hxx
+++ b/dbaccess/source/inc/apitools.hxx
@@ -328,21 +328,14 @@ public:
return new ::cppu::OPropertyArrayHelper(aDescriptor);
#define NOTIFY_LISTERNERS(_rListeners,T,method) \
- Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \
- \
- const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray(); \
- const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \
+ std::vector< Reference< XInterface > > aListenerSeq = _rListeners.getElementsAsVector(); \
\
_rGuard.clear(); \
- while( pxInt > pxIntBegin ) \
+ for( auto iter = aListenerSeq.rbegin(); iter != aListenerSeq.rend(); ++iter ) \
{ \
try \
{ \
- while( pxInt > pxIntBegin ) \
- { \
- --pxInt; \
- static_cast< T* >( pxInt->get() )->method(aEvt); \
- } \
+ static_cast< T* >( (*iter).get() )->method(aEvt); \
} \
catch( RuntimeException& ) \
{ \
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 720e8ab..6963e86 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -596,10 +596,10 @@ void Package::fireModified()
::cppu::OInterfaceContainerHelper * container = rBHelper.getContainer(
cppu::UnoType<util::XModifyListener>::get() );
if (container != 0) {
- Sequence< Reference<XInterface> > elements(
- container->getElements() );
+ std::vector< Reference<XInterface> > elements(
+ container->getElementsAsVector() );
lang::EventObject evt( static_cast<OWeakObject *>(this) );
- for ( sal_Int32 pos = 0; pos < elements.getLength(); ++pos )
+ for ( sal_Int32 pos = 0; pos < (sal_Int32)elements.size(); ++pos )
{
Reference<util::XModifyListener> xListener(
elements[ pos ], UNO_QUERY );
diff --git a/embedserv/source/embed/intercept.cxx b/embedserv/source/embed/intercept.cxx
index 20dcfd1..e335d12 100644
--- a/embedserv/source/embed/intercept.cxx
+++ b/embedserv/source/embed/intercept.cxx
@@ -218,10 +218,10 @@ void Interceptor::generateFeatureStateEvent()
cppu::OInterfaceContainerHelper* pICH =
m_pStatCL->getContainer(m_aInterceptedURL[i]);
- uno::Sequence<uno::Reference<uno::XInterface> > aSeq;
+ std::vector<uno::Reference<uno::XInterface> > aSeq;
if(pICH)
- aSeq = pICH->getElements();
- if(!aSeq.getLength())
+ aSeq = pICH->getElementsAsVector();
+ if(aSeq.empty())
continue;
frame::FeatureStateEvent aStateEvent;
@@ -249,13 +249,11 @@ void Interceptor::generateFeatureStateEvent()
}
- for(sal_Int32 k = 0; k < aSeq.getLength(); ++k)
+ for(uno::Reference<uno::XInterface> & x : aSeq)
{
- uno::Reference<frame::XStatusListener>
- Control(aSeq[k],uno::UNO_QUERY);
+ uno::Reference<frame::XStatusListener> Control(x,uno::UNO_QUERY);
if(Control.is())
Control->statusChanged(aStateEvent);
-
}
}
}
diff --git a/include/cppuhelper/interfacecontainer.h b/include/cppuhelper/interfacecontainer.h
index a29eba0..74338f6 100644
--- a/include/cppuhelper/interfacecontainer.h
+++ b/include/cppuhelper/interfacecontainer.h
@@ -47,7 +47,7 @@ namespace detail {
*/
union element_alias
{
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > *pAsSequence;
+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > *pAsVector;
::com::sun::star::uno::XInterface * pAsInterface;
element_alias() : pAsInterface(0) {}
};
@@ -155,10 +155,18 @@ public:
*/
sal_Int32 SAL_CALL getLength() const;
+#ifdef LIBO_INTERNAL_ONLY
/**
Return all interfaces added to this container.
+ @since LibreOffice 5.1
+ Not exposed because std::vector is problematic for an ABI
**/
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > SAL_CALL getElements() const;
+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > SAL_CALL getElementsAsVector() const;
+#endif
+ /**
+ Return all interfaces added to this container.
+ **/
+ css::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > SAL_CALL getElements() const;
/** Inserts an element into the container. The position is not specified, thus it is not
specified in which order events are fired.
@@ -236,14 +244,14 @@ public:
private:
friend class OInterfaceIteratorHelper;
/**
- bIsList == TRUE -> aData.pAsSequence of type Sequence< XInterfaceSequence >,
+ bIsList == TRUE -> aData.pAsVector of type std::vector< XInterface >,
otherwise aData.pAsInterface == of type (XEventListener *)
*/
detail::element_alias aData;
::osl::Mutex & rMutex;
/** TRUE -> used by an iterator. */
sal_Bool bInUse;
- /** TRUE -> aData.pAsSequence is of type Sequence< XInterfaceSequence >. */
+ /** TRUE -> aData.pAsVector is of type std::vector< XInterface >. */
sal_Bool bIsList;
OInterfaceContainerHelper( const OInterfaceContainerHelper & )
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 94c29dc..b5ec70b 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -410,32 +410,19 @@ void SAL_CALL ScCellFieldsObj::refresh( )
if (mpRefreshListeners)
{
// Call all listeners.
- uno::Sequence< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElements());
- sal_uInt32 nLength(aListeners.getLength());
- if (nLength)
+ std::vector< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElementsAsVector());
+ if (!aListeners.empty())
{
- const uno::Reference< uno::XInterface >* pInterfaces = aListeners.getConstArray();
- if (pInterfaces)
+ lang::EventObject aEvent;
+ aEvent.Source.set(uno::Reference< util::XRefreshable >(this));
+ for (auto & x : aListeners)
{
- lang::EventObject aEvent;
- aEvent.Source.set(uno::Reference< util::XRefreshable >(this));
- sal_uInt32 i(0);
- while (i < nLength)
+ try
+ {
+ static_cast< util::XRefreshListener* >(x.get())->refreshed(aEvent);
+ }
+ catch(uno::RuntimeException&)
{
- try
- {
- while(i < nLength)
- {
- static_cast< util::XRefreshListener* >(pInterfaces->get())->refreshed(aEvent);
- ++pInterfaces;
- ++i;
- }
- }
- catch(uno::RuntimeException&)
- {
- ++pInterfaces;
- ++i;
- }
}
}
}
@@ -590,32 +577,19 @@ void SAL_CALL ScHeaderFieldsObj::refresh( )
if (mpRefreshListeners)
{
// Call all listeners.
- uno::Sequence< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElements());
- sal_uInt32 nLength(aListeners.getLength());
- if (nLength)
+ std::vector< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElementsAsVector());
+ if (!aListeners.empty())
{
- const uno::Reference< uno::XInterface >* pInterfaces = aListeners.getConstArray();
- if (pInterfaces)
+ lang::EventObject aEvent;
+ aEvent.Source.set(uno::Reference< util::XRefreshable >(this));
+ for (auto & x : aListeners)
{
- lang::EventObject aEvent;
- aEvent.Source.set(uno::Reference< util::XRefreshable >(this));
- sal_uInt32 i(0);
- while (i < nLength)
+ try
+ {
+ static_cast< util::XRefreshListener* >(x.get())->refreshed(aEvent);
+ }
+ catch(uno::RuntimeException&)
{
- try
- {
- while(i < nLength)
- {
- static_cast< util::XRefreshListener* >(pInterfaces->get())->refreshed(aEvent);
- ++pInterfaces;
- ++i;
- }
- }
- catch(uno::RuntimeException&)
- {
- ++pInterfaces;
- ++i;
- }
}
}
}
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 4ed6289..86d9ba3 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -345,14 +345,13 @@ bool SdStyleSheet::IsUsed() const
OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( cppu::UnoType<XModifyListener>::get() );
if( pContainer )
{
- Sequence< Reference< XInterface > > aModifyListeners( pContainer->getElements() );
- Reference< XInterface > *p = aModifyListeners.getArray();
- sal_Int32 nCount = aModifyListeners.getLength();
- while( nCount-- && !bResult )
+ for( auto & x : pContainer->getElements() )
{
- Reference< XStyle > xStyle( *p++, UNO_QUERY );
- if( xStyle.is() )
+ Reference< XStyle > xStyle( x, UNO_QUERY );
+ if( xStyle.is() ) {
bResult = xStyle->isInUse();
+ break;
+ }
}
}
}
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 54b4a90..a8b567f 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -2282,11 +2282,11 @@ void SfxDocumentMetaData::createUserDefined()
m_xUserDefined, css::uno::UNO_QUERY);
if (xMB.is())
{
- const css::uno::Sequence<css::uno::Reference<css::uno::XInterface> >
- listeners(m_NotifyListeners.getElements());
- for (css::uno::Reference< css::uno::XInterface > const * iter = listeners.begin(); iter != listeners.end(); ++iter) {
+ const std::vector<css::uno::Reference<css::uno::XInterface> >
+ listeners(m_NotifyListeners.getElementsAsVector());
+ for (css::uno::Reference< css::uno::XInterface > const & iter : listeners) {
xMB->addModifyListener(
- css::uno::Reference< css::util::XModifyListener >(*iter,
+ css::uno::Reference< css::util::XModifyListener >(iter,
css::uno::UNO_QUERY));
}
}
diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx
index 66c0544..2f0dbc9 100644
--- a/svx/source/table/tabledesign.cxx
+++ b/svx/source/table/tabledesign.cxx
@@ -235,10 +235,10 @@ sal_Bool SAL_CALL TableDesignStyle::isInUse() throw (RuntimeException, std::exce
OInterfaceContainerHelper * pContainer = rBHelper.getContainer( cppu::UnoType<XModifyListener>::get() );
if( pContainer )
{
- Sequence< Reference< XInterface > > aListener( pContainer->getElements() );
+ std::vector< Reference< XInterface > > aListener( pContainer->getElementsAsVector() );
aGuard.clear();
- sal_Int32 nIndex = aListener.getLength();
+ sal_Int32 nIndex = aListener.size();
while( --nIndex >= 0 )
{
TableDesignUser* pUser = dynamic_cast< TableDesignUser* >( aListener[nIndex].get() );
diff --git a/svx/source/unodraw/unoshcol.cxx b/svx/source/unodraw/unoshcol.cxx
index 20133ca..1a94ecf 100644
--- a/svx/source/unodraw/unoshcol.cxx
+++ b/svx/source/unodraw/unoshcol.cxx
@@ -229,10 +229,10 @@ uno::Any SAL_CALL SvxShapeCollection::getByIndex( sal_Int32 Index )
if( Index < 0 || Index >= getCount() )
throw lang::IndexOutOfBoundsException();
- uno::Sequence< Reference< uno::XInterface> > xElements( maShapeContainer.getElements() );
+ std::vector< Reference< uno::XInterface> > xElements( maShapeContainer.getElementsAsVector() );
- return uno::makeAny( Reference< drawing::XShape>(static_cast< drawing::XShape* >( xElements.getArray()[Index].get())) );
+ return uno::makeAny( Reference< drawing::XShape>(static_cast< drawing::XShape* >( xElements[Index].get())) );
}
// XElementAccess
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index cf14157..ce25b2b 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1757,13 +1757,13 @@ void VCLXToolkit::callTopWindowListeners(
= static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow();
if (pWindow->IsTopWindow())
{
- css::uno::Sequence< css::uno::Reference< css::uno::XInterface > >
- aListeners(m_aTopWindowListeners.getElements());
- if (aListeners.hasElements())
+ std::vector< css::uno::Reference< css::uno::XInterface > >
+ aListeners(m_aTopWindowListeners.getElementsAsVector());
+ if (!aListeners.empty())
{
css::lang::EventObject aAwtEvent(
static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()));
- for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i)
+ for (::sal_Int32 i = 0; i < (sal_Int32)aListeners.size(); ++i)
{
css::uno::Reference< css::awt::XTopWindowListener >
xListener(aListeners[i], css::uno::UNO_QUERY);
@@ -1786,10 +1786,10 @@ void VCLXToolkit::callTopWindowListeners(
long VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent,
bool bPressed)
{
- css::uno::Sequence< css::uno::Reference< css::uno::XInterface > >
- aHandlers(m_aKeyHandlers.getElements());
+ std::vector< css::uno::Reference< css::uno::XInterface > >
+ aHandlers(m_aKeyHandlers.getElementsAsVector());
- if (aHandlers.hasElements())
+ if (!aHandlers.empty())
{
vcl::Window * pWindow = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow();
@@ -1809,7 +1809,7 @@ long VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent,
pKeyEvent->GetKeyCode().GetCode(), pKeyEvent->GetCharCode(),
sal::static_int_cast< sal_Int16 >(
pKeyEvent->GetKeyCode().GetFunction()));
- for (::sal_Int32 i = 0; i < aHandlers.getLength(); ++i)
+ for (::sal_Int32 i = 0; i < (sal_Int32)aHandlers.size(); ++i)
{
css::uno::Reference< css::awt::XKeyHandler > xHandler(
aHandlers[i], css::uno::UNO_QUERY);
@@ -1838,9 +1838,9 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent,
= static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow();
if (pWindow->IsTopWindow())
{
- css::uno::Sequence< css::uno::Reference< css::uno::XInterface > >
- aListeners(m_aFocusListeners.getElements());
- if (aListeners.hasElements())
+ std::vector< css::uno::Reference< css::uno::XInterface > >
+ aListeners(m_aFocusListeners.getElementsAsVector());
+ if (!aListeners.empty())
{
// Ignore the interior of compound controls when determining the
// window that gets the focus next (see implementation in
@@ -1859,7 +1859,7 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent,
static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()),
static_cast<sal_Int16>(pWindow->GetGetFocusFlags()),
xNext, false);
- for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i)
+ for (size_t i = 0; i < aListeners.size(); ++i)
{
css::uno::Reference< css::awt::XFocusListener > xListener(
aListeners[i], css::uno::UNO_QUERY);
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
index a7eff04..b064aff 100644
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -916,13 +916,11 @@ void ControlModelContainerBase::implNotifyTabModelChange( const OUString& _rAcce
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 )
+ std::vector< Reference< XInterface > > aChangeListeners( maChangeListeners.getElementsAsVector() );
+ for ( Reference< XInterface > & rListener : aChangeListeners )
{
- if ( pListener->is() )
- static_cast< XChangesListener* >( pListener->get() )->changesOccurred( aEvent );
+ if ( rListener.is() )
+ static_cast< XChangesListener* >( rListener.get() )->changesOccurred( aEvent );
}
}
diff --git a/ucb/source/ucp/file/filrset.cxx b/ucb/source/ucp/file/filrset.cxx
index e4d8159..820fda5 100644
--- a/ucb/source/ucp/file/filrset.cxx
+++ b/ucb/source/ucp/file/filrset.cxx
@@ -162,11 +162,11 @@ XResultSet_impl::dispose()
void XResultSet_impl::rowCountChanged()
{
sal_Int32 aOldValue,aNewValue;
- uno::Sequence< uno::Reference< uno::XInterface > > seq;
+ std::vector< uno::Reference< uno::XInterface > > seq;
{
osl::MutexGuard aGuard( m_aMutex );
if( m_pRowCountListeners )
- seq = m_pRowCountListeners->getElements();
+ seq = m_pRowCountListeners->getElementsAsVector();
aNewValue = m_aItems.size();
aOldValue = aNewValue-1;
}
@@ -176,7 +176,7 @@ void XResultSet_impl::rowCountChanged()
aEv.PropertyHandle = -1;
aEv.OldValue <<= aOldValue;
aEv.NewValue <<= aNewValue;
- for( sal_Int32 i = 0; i < seq.getLength(); ++i )
+ for( sal_Int32 i = 0; i < (sal_Int32)seq.size(); ++i )
{
uno::Reference< beans::XPropertyChangeListener > listener(
seq[i], uno::UNO_QUERY );
@@ -188,11 +188,11 @@ void XResultSet_impl::rowCountChanged()
void XResultSet_impl::isFinalChanged()
{
- uno::Sequence< uno::Reference< XInterface > > seq;
+ std::vector< uno::Reference< XInterface > > seq;
{
osl::MutexGuard aGuard( m_aMutex );
if( m_pIsFinalListeners )
- seq = m_pIsFinalListeners->getElements();
+ seq = m_pIsFinalListeners->getElementsAsVector();
m_bRowCountFinal = true;
}
beans::PropertyChangeEvent aEv;
@@ -203,7 +203,7 @@ void XResultSet_impl::isFinalChanged()
bool tval = true;
aEv.OldValue <<= fval;
aEv.NewValue <<= tval;
- for( sal_Int32 i = 0; i < seq.getLength(); ++i )
+ for( sal_Int32 i = 0; i < (sal_Int32)seq.size(); ++i )
{
uno::Reference< beans::XPropertyChangeListener > listener(
seq[i], uno::UNO_QUERY );
commit 371200675c2fb2fef0ac8362ebd7bf4203835440
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jun 29 09:15:16 2015 +0200
drop yet another reimplementation of rtl::Reference (SotMutexHolderRef)
Change-Id: I57f9dff931242405420bd45fae7ec5f13718707f
diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index 510353e..18d2f0a 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -81,7 +81,7 @@ protected:
// aMediaType parameter is used only for raw stream header creation
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > createUnbufferedStream(
- SotMutexHolderRef aMutexHolder,
+ const rtl::Reference<SotMutexHolder>& aMutexHolder,
ZipEntry & rEntry,
const ::rtl::Reference < EncryptionData > &rData,
sal_Int8 nStreamMode,
@@ -121,7 +121,7 @@ public:
ZipEntry& rEntry,
const ::rtl::Reference < EncryptionData > &rData,
bool bDecrypt,
- SotMutexHolderRef aMutexHolder )
+ const rtl::Reference<SotMutexHolder>& aMutexHolder )
throw(::com::sun::star::io::IOException, ::com::sun::star::packages::zip::ZipException, ::com::sun::star::uno::RuntimeException);
static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > StaticGetDigestContextForChecksum(
@@ -164,14 +164,14 @@ public:
ZipEntry& rEntry,
const ::rtl::Reference < EncryptionData > &rData,
bool bDecrypt,
- SotMutexHolderRef aMutexHolder )
+ const rtl::Reference<SotMutexHolder>& aMutexHolder )
throw(::com::sun::star::io::IOException, ::com::sun::star::packages::zip::ZipException, ::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getDataStream(
ZipEntry& rEntry,
const ::rtl::Reference < EncryptionData > &rData,
bool bDecrypt,
- SotMutexHolderRef aMutexHolder )
+ const rtl::Reference<SotMutexHolder>& aMutexHolder )
throw ( ::com::sun::star::packages::WrongPasswordException,
::com::sun::star::io::IOException,
::com::sun::star::packages::zip::ZipException,
@@ -181,7 +181,7 @@ public:
ZipEntry& rEntry,
const ::rtl::Reference < EncryptionData > &rData,
const OUString& aMediaType,
- SotMutexHolderRef aMutexHolder )
+ const rtl::Reference<SotMutexHolder>& aMutexHolder )
throw ( ::com::sun::star::packages::NoEncryptionException,
::com::sun::star::io::IOException,
::com::sun::star::packages::zip::ZipException,
diff --git a/package/inc/ZipPackage.hxx b/package/inc/ZipPackage.hxx
index 86d6e10..1318876 100644
--- a/package/inc/ZipPackage.hxx
+++ b/package/inc/ZipPackage.hxx
@@ -75,7 +75,7 @@ class ZipPackage : public cppu::WeakImplHelper7
>
{
protected:
- SotMutexHolderRef m_aMutexHolder;
+ rtl::Reference<SotMutexHolder> m_aMutexHolder;
::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > m_aStorageEncryptionKeys;
::com::sun::star::uno::Sequence< sal_Int8 > m_aEncryptionKey;
@@ -133,7 +133,7 @@ public:
sal_Int32 GetChecksumAlgID() const { return m_nChecksumDigestID; }
sal_Int32 GetDefaultDerivedKeySize() const { return m_nCommonEncryptionID == ::com::sun::star::xml::crypto::CipherID::AES_CBC_W3C_PADDING ? 32 : 16; }
- SotMutexHolderRef GetSharedMutexRef() { return m_aMutexHolder; }
+ rtl::Reference<SotMutexHolder>& GetSharedMutexRef() { return m_aMutexHolder; }
void ConnectTo( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream );
const ::com::sun::star::uno::Sequence< sal_Int8 > GetEncryptionKey();
diff --git a/package/inc/mutexholder.hxx b/package/inc/mutexholder.hxx
index 4b2e47f2..dac105f 100644
--- a/package/inc/mutexholder.hxx
+++ b/package/inc/mutexholder.hxx
@@ -21,102 +21,30 @@
#define INCLUDED_PACKAGE_INC_MUTEXHOLDER_HXX
#include <osl/mutex.hxx>
+#include <rtl/ref.hxx>
class SotMutexHolder
{
+friend class rtl::Reference<SotMutexHolder>;
+
::osl::Mutex m_aMutex;
sal_Int32 m_nRefCount;
- public:
- SotMutexHolder() : m_nRefCount( 0 ) {}
-
- void AddRef()
+ void acquire()
{
m_nRefCount++;
}
- void ReleaseRef()
+ void release()
{
if ( !--m_nRefCount )
delete this;
}
- ::osl::Mutex& GetMutex() { return m_aMutex; }
-};
-
-class SotMutexHolderRef
-{
- SotMutexHolder* m_pHolder;
-
public:
- SotMutexHolderRef()
- : m_pHolder( NULL )
- {}
-
- SotMutexHolderRef( SotMutexHolder* pHolder )
- : m_pHolder( pHolder )
- {
- if ( m_pHolder )
- m_pHolder->AddRef();
- }
-
- SotMutexHolderRef( const SotMutexHolderRef& rRef )
- : m_pHolder( rRef.m_pHolder )
- {
- if ( m_pHolder )
- m_pHolder->AddRef();
- }
-
- ~SotMutexHolderRef()
- {
- if ( m_pHolder )
- m_pHolder->ReleaseRef();
- }
-
- SotMutexHolderRef& operator =( const SotMutexHolderRef& rRef )
- {
- if ( m_pHolder )
- m_pHolder->ReleaseRef();
-
- m_pHolder = rRef.m_pHolder;
-
- if ( m_pHolder )
- m_pHolder->AddRef();
-
- return *this;
- }
-
- SotMutexHolderRef& operator =( SotMutexHolder* pHolder )
- {
- if ( m_pHolder )
- m_pHolder->ReleaseRef();
-
- m_pHolder = pHolder;
-
- if ( m_pHolder )
- m_pHolder->AddRef();
- return *this;
- }
-
- SotMutexHolder* operator ->() const
- {
- return m_pHolder;
- }
-
- SotMutexHolder& operator *() const
- {
- return *m_pHolder;
- }
-
- operator SotMutexHolder*() const
- {
- return m_pHolder;
- }
+ SotMutexHolder() : m_nRefCount( 0 ) {}
- bool Is() const
- {
- return m_pHolder != NULL;
- }
+ ::osl::Mutex& GetMutex() { return m_aMutex; }
};
#endif
diff --git a/package/inc/zipfileaccess.hxx b/package/inc/zipfileaccess.hxx
index 553d4cb..c7cee90 100644
--- a/package/inc/zipfileaccess.hxx
+++ b/package/inc/zipfileaccess.hxx
@@ -42,7 +42,7 @@ class OZipFileAccess : public ::cppu::WeakImplHelper4<
::com::sun::star::lang::XComponent,
::com::sun::star::lang::XServiceInfo >
{
- SotMutexHolderRef m_aMutexHolder;
+ rtl::Reference<SotMutexHolder> m_aMutexHolder;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx
index 0056184..c772cbe 100644
--- a/package/source/xstor/ocompinstream.cxx
+++ b/package/source/xstor/ocompinstream.cxx
@@ -40,8 +40,8 @@ OInputCompStream::OInputCompStream( OWriteStream_Impl& aImpl,
, m_bDisposed( false )
, m_nStorageType( nStorageType )
{
- OSL_ENSURE( m_pImpl->m_rMutexRef.Is(), "No mutex is provided!\n" );
- if ( !m_pImpl->m_rMutexRef.Is() )
+ OSL_ENSURE( m_pImpl->m_rMutexRef.is(), "No mutex is provided!\n" );
+ if ( !m_pImpl->m_rMutexRef.is() )
throw uno::RuntimeException(); // just a disaster
assert(m_xStream.is());
diff --git a/package/source/xstor/ocompinstream.hxx b/package/source/xstor/ocompinstream.hxx
index bbc5b26..6fb15ac 100644
--- a/package/source/xstor/ocompinstream.hxx
+++ b/package/source/xstor/ocompinstream.hxx
@@ -42,7 +42,7 @@ class OInputCompStream : public cppu::WeakImplHelper4 < ::com::sun::star::io::XI
protected:
OWriteStream_Impl* m_pImpl;
- SotMutexHolderRef m_rMutexRef;
+ rtl::Reference<SotMutexHolder> m_rMutexRef;
::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > m_xStream;
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 59d8de6..7b10621 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -57,13 +57,13 @@ using namespace ::com::sun::star;
struct WSInternalData_Impl
{
- SotMutexHolderRef m_rSharedMutexRef;
+ rtl::Reference<SotMutexHolder> m_rSharedMutexRef;
::std::unique_ptr< ::cppu::OTypeCollection> m_pTypeCollection;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenersContainer; // list of listeners
sal_Int32 m_nStorageType;
// the mutex reference MUST NOT be empty
- WSInternalData_Impl( const SotMutexHolderRef& rMutexRef, sal_Int32 nStorageType )
+ WSInternalData_Impl( const rtl::Reference<SotMutexHolder>& rMutexRef, sal_Int32 nStorageType )
: m_rSharedMutexRef( rMutexRef )
, m_pTypeCollection()
, m_aListenersContainer( rMutexRef->GetMutex() )
@@ -1694,9 +1694,9 @@ OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, bool bTransacted )
, m_bTransacted( bTransacted )
{
OSL_ENSURE( pImpl, "No base implementation!\n" );
- OSL_ENSURE( m_pImpl->m_rMutexRef.Is(), "No mutex!\n" );
+ OSL_ENSURE( m_pImpl->m_rMutexRef.is(), "No mutex!\n" );
- if ( !m_pImpl || !m_pImpl->m_rMutexRef.Is() )
+ if ( !m_pImpl || !m_pImpl->m_rMutexRef.is() )
throw uno::RuntimeException(); // just a disaster
m_pData.reset(new WSInternalData_Impl(pImpl->m_rMutexRef, m_pImpl->m_nStorageType));
@@ -1710,9 +1710,9 @@ OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, uno::Reference< io::XStrea
, m_bTransacted( bTransacted )
{
OSL_ENSURE( pImpl && xStream.is(), "No base implementation!\n" );
- OSL_ENSURE( m_pImpl->m_rMutexRef.Is(), "No mutex!\n" );
+ OSL_ENSURE( m_pImpl->m_rMutexRef.is(), "No mutex!\n" );
- if ( !m_pImpl || !m_pImpl->m_rMutexRef.Is() )
+ if ( !m_pImpl || !m_pImpl->m_rMutexRef.is() )
throw uno::RuntimeException(); // just a disaster
m_pData.reset(new WSInternalData_Impl(pImpl->m_rMutexRef, m_pImpl->m_nStorageType));
diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx
index 2a5b1cf..9da76c7 100644
--- a/package/source/xstor/owriteablestream.hxx
+++ b/package/source/xstor/owriteablestream.hxx
@@ -58,7 +58,7 @@ namespace com { namespace sun { namespace star { namespace uno {
struct PreCreationStruct
{
- SotMutexHolderRef m_rMutexRef;
+ const rtl::Reference<SotMutexHolder> m_rMutexRef;
PreCreationStruct()
: m_rMutexRef( new SotMutexHolder )
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index daca1c3..ed2ae15 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -68,7 +68,7 @@ typedef ::std::list< uno::WeakReference< lang::XComponent > > WeakComponentList;
struct StorInternalData_Impl
{
- SotMutexHolderRef m_rSharedMutexRef;
+ rtl::Reference<SotMutexHolder> m_rSharedMutexRef;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenersContainer; // list of listeners
::std::unique_ptr< ::cppu::OTypeCollection> m_pTypeCollection;
bool m_bIsRoot;
@@ -82,7 +82,7 @@ struct StorInternalData_Impl
::rtl::Reference< OHierarchyHolder_Impl > m_rHierarchyHolder;
// the mutex reference MUST NOT be empty
- StorInternalData_Impl( const SotMutexHolderRef& rMutexRef, bool bRoot, sal_Int32 nStorageType, bool bReadOnlyWrap )
+ StorInternalData_Impl( const rtl::Reference<SotMutexHolder>& rMutexRef, bool bRoot, sal_Int32 nStorageType, bool bReadOnlyWrap )
: m_rSharedMutexRef( rMutexRef )
, m_aListenersContainer( rMutexRef->GetMutex() )
, m_pTypeCollection()
@@ -1902,7 +1902,7 @@ OStorage::OStorage( OStorage_Impl* pImpl, bool bReadOnlyWrap )
: m_pImpl( pImpl )
{
// this call can be done only from OStorage_Impl implementation to create child storage
- OSL_ENSURE( m_pImpl && m_pImpl->m_rMutexRef.Is(), "The provided pointer & mutex MUST NOT be empty!\n" );
+ OSL_ENSURE( m_pImpl && m_pImpl->m_rMutexRef.is(), "The provided pointer & mutex MUST NOT be empty!\n" );
m_pData.reset(new StorInternalData_Impl( m_pImpl->m_rMutexRef, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, bReadOnlyWrap));
diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx
index d52a839..6e7879f 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -117,19 +117,19 @@ struct OStorage_Impl
{
typedef std::list<StorageHolder_Impl> StorageHoldersType;
- SotMutexHolderRef m_rMutexRef;
+ rtl::Reference<SotMutexHolder> m_rMutexRef;
OStorage* m_pAntiImpl; // only valid if external references exists
- StorageHoldersType m_aReadOnlyWrapList; // only valid if readonly external reference exists
+ StorageHoldersType m_aReadOnlyWrapList; // only valid if readonly external reference exists
sal_Int32 m_nStorageMode; // open mode ( read/write/trunc/nocreate )
- bool m_bIsModified; // only modified elements will be sent to the original content
- bool m_bBroadcastModified; // will be set if notification is required
+ bool m_bIsModified; // only modified elements will be sent to the original content
+ bool m_bBroadcastModified; // will be set if notification is required
- bool m_bCommited; // sending the streams is coordinated by the root storage of the package
+ bool m_bCommited; // sending the streams is coordinated by the root storage of the package
- bool m_bIsRoot; // marks this storage as root storages that manages all commits and reverts
- bool m_bListCreated;
+ bool m_bIsRoot; // marks this storage as root storages that manages all commits and reverts
+ bool m_bListCreated;
/// Count of registered modification listeners
oslInterlockedCount m_nModifiedListenerCount;
diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx
index 7ce12a2..3af35f9 100644
--- a/package/source/zipapi/XUnbufferedStream.cxx
+++ b/package/source/zipapi/XUnbufferedStream.cxx
@@ -41,7 +41,7 @@ using com::sun::star::packages::zip::ZipIOException;
XUnbufferedStream::XUnbufferedStream(
const uno::Reference< uno::XComponentContext >& xContext,
- SotMutexHolderRef aMutexHolder,
+ const rtl::Reference<SotMutexHolder>& aMutexHolder,
ZipEntry & rEntry,
Reference < XInputStream > xNewZipStream,
const ::rtl::Reference< EncryptionData >& rData,
@@ -49,7 +49,7 @@ XUnbufferedStream::XUnbufferedStream(
bool bIsEncrypted,
const OUString& aMediaType,
bool bRecoveryMode )
-: maMutexHolder( aMutexHolder.Is() ? aMutexHolder : SotMutexHolderRef( new SotMutexHolder ) )
+: maMutexHolder( aMutexHolder.is() ? aMutexHolder : rtl::Reference<SotMutexHolder>( new SotMutexHolder ) )
, mxZipStream ( xNewZipStream )
, mxZipSeek ( xNewZipStream, UNO_QUERY )
, maEntry ( rEntry )
diff --git a/package/source/zipapi/XUnbufferedStream.hxx b/package/source/zipapi/XUnbufferedStream.hxx
index e647284..922aa82 100644
--- a/package/source/zipapi/XUnbufferedStream.hxx
+++ b/package/source/zipapi/XUnbufferedStream.hxx
@@ -47,7 +47,7 @@ class XUnbufferedStream : public cppu::WeakImplHelper1
>
{
protected:
- SotMutexHolderRef maMutexHolder;
+ rtl::Reference<SotMutexHolder> maMutexHolder;
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > mxZipStream;
com::sun::star::uno::Reference < com::sun::star::io::XSeekable > mxZipSeek;
@@ -66,7 +66,7 @@ protected:
public:
XUnbufferedStream(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
- SotMutexHolderRef aMutexHolder,
+ const rtl::Reference<SotMutexHolder>& aMutexHolder,
ZipEntry & rEntry,
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewZipStream,
const ::rtl::Reference< EncryptionData >& rData,
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 71442c5..7d4b998 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -510,7 +510,7 @@ bool ZipFile::hasValidPassword ( ZipEntry & rEntry, const ::rtl::Reference< Encr
}
uno::Reference< XInputStream > ZipFile::createUnbufferedStream(
- SotMutexHolderRef aMutexHolder,
+ const rtl::Reference<SotMutexHolder>& aMutexHolder,
ZipEntry & rEntry,
const ::rtl::Reference< EncryptionData > &rData,
sal_Int8 nStreamMode,
@@ -530,7 +530,7 @@ ZipEnumeration * SAL_CALL ZipFile::entries( )
uno::Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
const ::rtl::Reference< EncryptionData > &rData,
bool bIsEncrypted,
- SotMutexHolderRef aMutexHolder )
+ const rtl::Reference<SotMutexHolder>& aMutexHolder )
throw(IOException, ZipException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -558,7 +558,7 @@ uno::Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntr
uno::Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry,
const ::rtl::Reference< EncryptionData > &rData,
bool bIsEncrypted,
- SotMutexHolderRef aMutexHolder )
+ const rtl::Reference<SotMutexHolder>& aMutexHolder )
throw ( packages::WrongPasswordException,
IOException,
ZipException,
@@ -598,7 +598,7 @@ uno::Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry
uno::Reference< XInputStream > SAL_CALL ZipFile::getRawData( ZipEntry& rEntry,
const ::rtl::Reference< EncryptionData >& rData,
bool bIsEncrypted,
- SotMutexHolderRef aMutexHolder )
+ const rtl::Reference<SotMutexHolder>& aMutexHolder )
throw(IOException, ZipException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -613,7 +613,7 @@ uno::Reference< XInputStream > SAL_CALL ZipFile::getWrappedRawStream(
ZipEntry& rEntry,
const ::rtl::Reference< EncryptionData >& rData,
const OUString& aMediaType,
- SotMutexHolderRef aMutexHolder )
+ const rtl::Reference<SotMutexHolder>& aMutexHolder )
throw ( packages::NoEncryptionException,
IOException,
ZipException,
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list