Rebased ref, commits from common ancestor: commit 49e6268ab39415507585d33d4e7272a63bb380d4 Author: Pranav Kant <pran...@gnome.org> Date: Tue Jun 9 16:27:37 2015 +0530
lokdocview: Change parent class to GtkDrawingArea It is not the job of the widget to provide the scroll bars. Change-Id: Iafc5724ed5b21717d711bb8f7e1a076dd1288b76 diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h index e84feee..d12d73f 100644 --- a/include/LibreOfficeKit/LibreOfficeKitGtk.h +++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h @@ -31,21 +31,23 @@ typedef struct _LOKDocViewClass LOKDocViewClass; struct _LOKDocView { - GtkScrolledWindow aScrollWindow; + GtkDrawingArea aScrollWindow; struct LOKDocView_Impl* m_pImpl; }; struct _LOKDocViewClass { - GtkScrolledWindowClass parent_class; - void (* edit_changed) (LOKDocView* pView, gboolean was_edit); - void (* command_changed) (LOKDocView* pView, char* new_state); - void (* search_not_found) (LOKDocView* pView, char* new_state); - void (* part_changed) (LOKDocView* pView, int new_part); + GtkDrawingAreaClass parent_class; + void (* edit_changed) (LOKDocView* pView, gboolean was_edit); + void (* command_changed) (LOKDocView* pView, char* new_state); + void (* search_not_found) (LOKDocView* pView, char* new_state); + void (* part_changed) (LOKDocView* pView, int new_part); }; GType lok_doc_view_get_type (void) G_GNUC_CONST; + GtkWidget* lok_doc_view_new (LibreOfficeKit* pOffice ); + gboolean lok_doc_view_open_document (LOKDocView* pDocView, char* pPath); @@ -80,9 +82,11 @@ void lok_doc_view_post_key (GtkWidget* p GdkEventKey* pEvent, gpointer pData); -/// Get the visible area of the document (in twips). -void lok_doc_view_get_visarea (LOKDocView* pThis, - GdkRectangle* pArea); +float lok_doc_view_pixel_to_twip (LOKDocView* pDocView, + float fInput); + +float lok_doc_view_pixel_to_twip (LOKDocView* pDocView, + float fInput); G_END_DECLS diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index 38b29ee..c8b47f7 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -38,6 +38,7 @@ static GtkToolItem* pBold; static GtkToolItem* pItalic; static GtkToolItem* pUnderline; static GtkToolItem* pStrikethrough; +static GtkWidget* pScrolledWindow; std::map<GtkToolItem*, std::string> g_aToolItemCommandNames; std::map<std::string, GtkToolItem*> g_aCommandNameToolItems; bool g_bToolItemBroadcast = true; @@ -134,6 +135,23 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/) #endif } +/// Get the visible area of the scrolled window +static void getVisibleAreaTwips(GdkRectangle* pArea) +{ + GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); + GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow)); + + pArea->x = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), + gtk_adjustment_get_value(pHAdjustment)); + pArea->y = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), + gtk_adjustment_get_value(pVAdjustment)); + pArea->width = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), + gtk_adjustment_get_page_size(pHAdjustment)); + pArea->height = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView), + gtk_adjustment_get_page_size(pVAdjustment)); +} + + /// Handles the key-press-event of the window. static gboolean signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData) { @@ -161,7 +179,7 @@ static void doSearch(bool bBackwards) LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView); GdkRectangle aArea; - lok_doc_view_get_visarea(pLOKDocView, &aArea); + getVisibleAreaTwips(&aArea); aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/type", '/'), "long"); aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/value", '/'), aArea.x); aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/type", '/'), "long"); @@ -461,7 +479,12 @@ int main( int argc, char* argv[] ) g_signal_connect(pWindow, "key-press-event", G_CALLBACK(signalKey), pDocView); g_signal_connect(pWindow, "key-release-event", G_CALLBACK(signalKey), pDocView); - gtk_container_add( GTK_CONTAINER(pVBox), pDocView ); + // Scrolled window for DocView + pScrolledWindow = gtk_scrolled_window_new(0, 0); + gtk_container_add(GTK_CONTAINER(pVBox), pScrolledWindow); + + // DocView doesn't have scrolling capability, so need a viewport + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(pScrolledWindow), pDocView); gtk_widget_show_all( pWindow ); // Hide the findbar by default. diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index ed3fc5c..5f642d9 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -41,7 +41,6 @@ struct LOKDocView_Impl { LOKDocView* m_pDocView; - GtkWidget *m_pDrawingArea; TileBuffer m_aTileBuffer; float m_fZoom; @@ -119,7 +118,7 @@ struct LOKDocView_Impl /// Connected to the destroy signal of LOKDocView, deletes its LOKDocView_Impl. static void destroy(LOKDocView* pDocView, gpointer pData); /// Connected to the expose-event of the GtkDrawingArea - static void on_exposed(GtkWidget *widget, GdkEvent *event, gpointer user_data); + static void onExposed(GtkWidget *widget, GdkEventExpose *event, gpointer user_data); /// Receives a key press or release event. void signalKey(GdkEventKey* pEvent); /** @@ -156,16 +155,8 @@ struct LOKDocView_Impl static gboolean handleTimeout(gpointer pData); /// Implementation of the timeout handler, invoked by handleTimeout(). gboolean handleTimeoutImpl(); - /** - * Renders the document to a number of visible tiles. - * - * This method is invoked only manually, not when some Gtk signal is - * emitted. - * - * @param pPartial if 0, then the full visible document is rendered, otherwise only - * the tiles that intersect with pPartial. - */ - void renderDocument(GdkRectangle* pPartial); + /// Implementation of expose event handler, invoked by onExposed(). + void onExposedImpl(GdkEventExpose* event); /// Returns the GdkRectangle of a x,y,width,height string. GdkRectangle payloadToRectangle(const char* pPayload); /// Returns the GdkRectangles of a x1,y1,w1,h1;x2,y2,w2,h2;... string. @@ -213,7 +204,7 @@ SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type(); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #endif -G_DEFINE_TYPE(LOKDocView, lok_doc_view, GTK_TYPE_SCROLLED_WINDOW) +G_DEFINE_TYPE(LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA) #ifdef __GNUC__ #pragma GCC diagnostic pop #endif @@ -279,7 +270,6 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView) : m_pDocView(pDocView), - m_pDrawingArea(gtk_drawing_area_new()), m_aTileBuffer(TileBuffer(0,0)), m_fZoom(1), m_pOffice(0), @@ -328,10 +318,70 @@ void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/) delete pDocView->m_pImpl; } -void LOKDocView_Impl::on_exposed(GtkWidget* /*widget*/, GdkEvent* /*event*/, gpointer userdata) +void LOKDocView_Impl::onExposed(GtkWidget* /*widget*/, GdkEventExpose* event, gpointer userdata) { LOKDocView *pDocView = LOK_DOC_VIEW (userdata); - pDocView->m_pImpl->renderDocument(0); + pDocView->m_pImpl->onExposedImpl(event); +} + +void LOKDocView_Impl::onExposedImpl(GdkEventExpose* event) +{ + long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips, m_fZoom); + long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips, m_fZoom); + // Total number of rows / columns in this document. + guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); + GdkRectangle aVisibleArea = event->area; + cairo_t *pcairo = gdk_cairo_create(GTK_WIDGET(m_pDocView)->window); + + aVisibleArea.x = pixelToTwip (aVisibleArea.x, m_fZoom); + aVisibleArea.y = pixelToTwip (aVisibleArea.y, m_fZoom); + aVisibleArea.width = pixelToTwip (aVisibleArea.width, m_fZoom); + aVisibleArea.height = pixelToTwip (aVisibleArea.height, m_fZoom); + + // Render the tiles. + for (guint nRow = 0; nRow < nRows; ++nRow) + { + for (guint nColumn = 0; nColumn < nColumns; ++nColumn) + { + GdkRectangle aTileRectangleTwips, aTileRectanglePixels; + bool bPaint = true; + + // Determine size of the tile: the rightmost/bottommost tiles may + // be smaller, and we need the size to decide if we need to repaint. + if (nColumn == nColumns - 1) + aTileRectanglePixels.width = nDocumentWidthPixels - nColumn * nTileSizePixels; + else + aTileRectanglePixels.width = nTileSizePixels; + if (nRow == nRows - 1) + aTileRectanglePixels.height = nDocumentHeightPixels - nRow * nTileSizePixels; + else + aTileRectanglePixels.height = nTileSizePixels; + + // Determine size and position of the tile in document coordinates, + // so we can decide if we can skip painting for partial rendering. + aTileRectangleTwips.x = pixelToTwip(nTileSizePixels, m_fZoom) * nColumn; + aTileRectangleTwips.y = pixelToTwip(nTileSizePixels, m_fZoom) * nRow; + aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width, m_fZoom); + aTileRectangleTwips.height = pixelToTwip(aTileRectanglePixels.height, m_fZoom); + + if (!gdk_rectangle_intersect(&aVisibleArea, &aTileRectangleTwips, 0)) + bPaint = false; + + if (bPaint) + { + Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn, m_fZoom); + GdkPixbuf* pPixBuf = currentTile.getBuffer(); + + gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, + twipToPixel(aTileRectangleTwips.x, m_fZoom), + twipToPixel(aTileRectangleTwips.y, m_fZoom)); + cairo_paint(pcairo); + } + } + } + + cairo_destroy(pcairo); } void LOKDocView_Impl::signalKey(GdkEventKey* pEvent) @@ -798,75 +848,12 @@ gboolean LOKDocView_Impl::handleTimeoutImpl() m_bCursorOverlayVisible = false; else m_bCursorOverlayVisible = true; - gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea)); + gtk_widget_queue_draw(GTK_WIDGET(m_pDocView)); } return G_SOURCE_CONTINUE; } -void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) -{ - GdkRectangle visibleArea; - lok_doc_view_get_visarea (m_pDocView, &visibleArea); - - long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips, m_fZoom); - long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips, m_fZoom); - // Total number of rows / columns in this document. - guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); - guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); - - cairo_t *pcairo = gdk_cairo_create(m_pDrawingArea->window); - - // Render the tiles. - for (guint nRow = 0; nRow < nRows; ++nRow) - { - for (guint nColumn = 0; nColumn < nColumns; ++nColumn) - { - GdkRectangle aTileRectangleTwips, aTileRectanglePixels; - bool bPaint = true; - - // Determine size of the tile: the rightmost/bottommost tiles may - // be smaller, and we need the size to decide if we need to repaint. - if (nColumn == nColumns - 1) - aTileRectanglePixels.width = nDocumentWidthPixels - nColumn * nTileSizePixels; - else - aTileRectanglePixels.width = nTileSizePixels; - if (nRow == nRows - 1) - aTileRectanglePixels.height = nDocumentHeightPixels - nRow * nTileSizePixels; - else - aTileRectanglePixels.height = nTileSizePixels; - - // Determine size and position of the tile in document coordinates, - // so we can decide if we can skip painting for partial rendering. - aTileRectangleTwips.x = pixelToTwip(nTileSizePixels, m_fZoom) * nColumn; - aTileRectangleTwips.y = pixelToTwip(nTileSizePixels, m_fZoom) * nRow; - aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width, m_fZoom); - aTileRectangleTwips.height = pixelToTwip(aTileRectanglePixels.height, m_fZoom); - if (pPartial && !gdk_rectangle_intersect(pPartial, &aTileRectangleTwips, 0)) - bPaint = false; - - if (!gdk_rectangle_intersect(&visibleArea, &aTileRectangleTwips, 0)) - bPaint = false; - - if (bPaint) - { - //g_info("tile_buffer_get_tile (%d, %d)", nRow, nColumn); - - Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn, m_fZoom); - GdkPixbuf* pPixBuf = currentTile.getBuffer(); - - gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, - twipToPixel(aTileRectangleTwips.x, m_fZoom), - twipToPixel(aTileRectangleTwips.y, m_fZoom)); - cairo_paint(pcairo); - } - } - } - - cairo_destroy(pcairo); -} - - GdkRectangle LOKDocView_Impl::payloadToRectangle(const char* pPayload) { GdkRectangle aRet; @@ -978,14 +965,14 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) else m_aTileBuffer.resetAllTiles(); - gtk_widget_queue_draw(m_pDrawingArea); + gtk_widget_queue_draw(GTK_WIDGET(m_pDocView)); } break; case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: { m_aVisibleCursor = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); m_bCursorOverlayVisible = true; - gtk_widget_queue_draw(m_pDrawingArea); + gtk_widget_queue_draw(GTK_WIDGET(m_pDocView)); } break; case LOK_CALLBACK_TEXT_SELECTION: @@ -1025,7 +1012,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) m_aGraphicSelection = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str()); else memset(&m_aGraphicSelection, 0, sizeof(m_aGraphicSelection)); - gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea)); + gtk_widget_queue_draw(GTK_WIDGET(m_pDocView)); } break; case LOK_CALLBACK_HYPERLINK_CLICKED: @@ -1049,7 +1036,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: { payloadToSize(pCallback->m_aPayload.c_str(), m_nDocumentWidthTwips, m_nDocumentHeightTwips); - gtk_widget_set_size_request(m_pDrawingArea, + gtk_widget_set_size_request(GTK_WIDGET(m_pDocView), twipToPixel(m_nDocumentWidthTwips, m_fZoom), twipToPixel(m_nDocumentHeightTwips, m_fZoom)); } @@ -1113,7 +1100,6 @@ void LOKDocView_Impl::searchNotFound(const std::string& rString) void LOKDocView_Impl::setPart(const std::string& rString) { g_signal_emit(m_pDocView, doc_view_signals[PART_CHANGED], 0, std::stoi(rString)); - renderDocument(0); } static void lok_doc_view_class_init (LOKDocViewClass* pClass) @@ -1163,34 +1149,26 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) static void lok_doc_view_init (LOKDocView* pDocView) { - // Gtk ScrolledWindow is apparently not fully initialised yet, we specifically - // have to set the [hv]adjustment to prevent GTK assertions from firing, see - // https://bugzilla.gnome.org/show_bug.cgi?id=438114 for more info. - gtk_scrolled_window_set_hadjustment( GTK_SCROLLED_WINDOW( pDocView ), NULL ); - gtk_scrolled_window_set_vadjustment( GTK_SCROLLED_WINDOW( pDocView ), NULL ); - pDocView->m_pImpl = new LOKDocView_Impl(pDocView); - gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(pDocView), - pDocView->m_pImpl->m_pDrawingArea ); - g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), + g_signal_connect(G_OBJECT(pDocView), "expose-event", - G_CALLBACK(LOKDocView_Impl::on_exposed), pDocView); - g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), + G_CALLBACK(LOKDocView_Impl::onExposed), pDocView); + g_signal_connect(G_OBJECT(pDocView), "expose-event", G_CALLBACK(LOKDocView_Impl::renderOverlay), pDocView); - gtk_widget_add_events(pDocView->m_pImpl->m_pDrawingArea, + gtk_widget_add_events(GTK_WIDGET(pDocView), GDK_BUTTON_PRESS_MASK |GDK_BUTTON_RELEASE_MASK |GDK_BUTTON_MOTION_MASK); - g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), + g_signal_connect(G_OBJECT(pDocView), "button-press-event", G_CALLBACK(LOKDocView_Impl::signalButton), pDocView); - g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), + g_signal_connect(G_OBJECT(pDocView), "button-release-event", G_CALLBACK(LOKDocView_Impl::signalButton), pDocView); - g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea), + g_signal_connect(G_OBJECT(pDocView), "motion-notify-event", G_CALLBACK(LOKDocView_Impl::signalMotion), pDocView); @@ -1240,10 +1218,9 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView, pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, nColumns); - gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, + gtk_widget_set_size_request(GTK_WIDGET(pDocView), nDocumentWidthPixels, nDocumentHeightPixels); - pDocView->m_pImpl->renderDocument(0); } return TRUE; @@ -1264,12 +1241,9 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, nColumns); - gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, + gtk_widget_set_size_request(GTK_WIDGET(pDocView), nDocumentWidthPixels, nDocumentHeightPixels); - - if ( pDocView->m_pImpl->m_pDocument ) - pDocView->m_pImpl->renderDocument(0); } SAL_DLLPUBLIC_EXPORT float lok_doc_view_get_zoom ( LOKDocView* pDocView ) @@ -1301,7 +1275,6 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_partmode( LOKDocView* pDocView, int nPartMode ) { pDocView->m_pImpl->m_pDocument->pClass->setPartMode( pDocView->m_pImpl->m_pDocument, nPartMode ); - pDocView->m_pImpl->renderDocument(0); } SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView, @@ -1318,7 +1291,7 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView, } pDocView->m_pImpl->m_bEdit = bEdit; g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit); - gtk_widget_queue_draw(GTK_WIDGET(pDocView->m_pImpl->m_pDrawingArea)); + gtk_widget_queue_draw(GTK_WIDGET(pDocView)); } SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_get_edit(LOKDocView* pDocView) @@ -1337,17 +1310,15 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_post_key(GtkWidget* /*pWidget*/, GdkEvent pDocView->m_pImpl->signalKey(pEvent); } -SAL_DLLPUBLIC_EXPORT void lok_doc_view_get_visarea(LOKDocView* pThis, GdkRectangle* pArea) +SAL_DLLPUBLIC_EXPORT float lok_doc_view_pixel_to_twip(LOKDocView* pDocView, float fInput) { -#if GTK_CHECK_VERSION(2,14,0) // we need gtk_adjustment_get_page_size() - float zoom = pThis->m_pImpl->m_fZoom; - GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pThis)); - pArea->x = pixelToTwip(gtk_adjustment_get_value(pHAdjustment),zoom); - pArea->width = pixelToTwip(gtk_adjustment_get_page_size(pHAdjustment), zoom); - GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pThis)); - pArea->y = pixelToTwip(gtk_adjustment_get_value(pVAdjustment), zoom); - pArea->height = pixelToTwip(gtk_adjustment_get_page_size(pVAdjustment), zoom); -#endif + return pixelToTwip(fInput, pDocView->m_pImpl->m_fZoom); } +SAL_DLLPUBLIC_EXPORT float lok_doc_view_twip_to_pixel(LOKDocView* pDocView, float fInput) +{ + return twipToPixel(fInput, pDocView->m_pImpl->m_fZoom); +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 46a76be3a13ad501e4d09da652f551b2c621e685 Author: Caolán McNamara <caol...@redhat.com> Date: Tue Jun 9 11:42:06 2015 +0100 restore "crash on layout of novell622972-2.html" temporarily This reverts commit dfedebd1e1912252bc2b5204a2b5371952b552cd. diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 9046788..5289d58 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1239,7 +1239,12 @@ bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, bool bAddRect ) aOldRect = static_cast<SwPageFrm*>(pLay)->GetBoundRect(); } - pLay->Calc(); + { + //JoinLock pParent for the lifetime of the Calc call to avoid + //SwSectionFrm::MergeNext removing the pLay we're trying to Format + FlowFrmJoinLockGuard aJoinGuard(pLay); + pLay->Calc(); + } if ( aOldFrame != pLay->Frm() ) bChanged = true; commit dfedebd1e1912252bc2b5204a2b5371952b552cd Author: Caolán McNamara <caol...@redhat.com> Date: Tue Jun 9 10:47:29 2015 +0100 Resolves: tdf#91695 partially Revert "crash on layout of novell622972-2.html" This reverts commit 9857c6390212e16dd9f26b47b4afc5d33b5242ef. Change-Id: Id47e982eb346c092991f07964c0146daefccb031 (cherry picked from commit 64dc505ce180a168798b725423a308207de42c63) diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 5289d58..9046788 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1239,12 +1239,7 @@ bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, bool bAddRect ) aOldRect = static_cast<SwPageFrm*>(pLay)->GetBoundRect(); } - { - //JoinLock pParent for the lifetime of the Calc call to avoid - //SwSectionFrm::MergeNext removing the pLay we're trying to Format - FlowFrmJoinLockGuard aJoinGuard(pLay); - pLay->Calc(); - } + pLay->Calc(); if ( aOldFrame != pLay->Frm() ) bChanged = true; commit e52bae937032dd5eac14da1d54b045ad9d787b1f Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Jun 9 11:58:24 2015 +0200 -Werror,-Wignored-attributes ("attribute declaration must precede definition") Change-Id: Iee0e9ef3a623706c33f84c34c1fbbf5b173f7f5d diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 4fb998e..ed3fc5c 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -208,6 +208,7 @@ enum static guint doc_view_signals[LAST_SIGNAL] = { 0 }; +SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type(); #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" @@ -1196,8 +1197,6 @@ static void lok_doc_view_init (LOKDocView* pDocView) g_signal_connect(G_OBJECT(pDocView), "destroy", G_CALLBACK(LOKDocView_Impl::destroy), 0); } -SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type(); - SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new( LibreOfficeKit* pOffice ) { LOKDocView* pDocView = LOK_DOC_VIEW(gtk_type_new(lok_doc_view_get_type())); commit 3f0e8bdabed165e09825bc78c55afb968a6d702a Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Jun 9 11:57:56 2015 +0200 loplugin:unreffun Change-Id: I2011b491012dfd623ece9fd24a265107ac690cba diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 7e50b96..4fb998e 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -208,9 +208,14 @@ enum static guint doc_view_signals[LAST_SIGNAL] = { 0 }; - +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" +#endif G_DEFINE_TYPE(LOKDocView, lok_doc_view, GTK_TYPE_SCROLLED_WINDOW) - +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif namespace { commit 9aa9baa78852dda5c348eb0abdbef98db3e910ed Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Jun 9 11:48:12 2015 +0200 loplugin:literaltoboolconversion Change-Id: I85fa46de5b864369158d047fd3f7c683f10c822f diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx index 1d6a8b6..2c0ee90 100644 --- a/libreofficekit/source/gtk/tilebuffer.cxx +++ b/libreofficekit/source/gtk/tilebuffer.cxx @@ -67,7 +67,7 @@ void TileBuffer::setInvalid(int x, int y) g_info("Setting tile invalid (%d, %d)", x, y); if (m_mTiles.find(index) != m_mTiles.end()) { - m_mTiles[index].valid = 0; + m_mTiles[index].valid = false; m_mTiles[index].release(); m_mTiles.erase(index); } @@ -101,7 +101,7 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom) //create a mapping for it m_mTiles[index].setPixbuf(pPixBuf); - m_mTiles[index].valid = 1; + m_mTiles[index].valid = true; } return m_mTiles[index]; diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx index b9bf71b..42c6d35 100644 --- a/libreofficekit/source/gtk/tilebuffer.hxx +++ b/libreofficekit/source/gtk/tilebuffer.hxx @@ -51,7 +51,7 @@ float twipToPixel(float fInput, float zoom); class Tile { public: - Tile() : valid(0) {} + Tile() : valid(false) {} ~Tile() { } /** commit 3a1a5b9744eb73f82c28ecfaa39b54587ef8206b Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Jun 9 11:42:41 2015 +0200 -Werror,-Wunused-private-field Change-Id: I76cf487c66e048b5e9d0877a1b690cd066b73528 diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 5f768e7..7e50b96 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -274,7 +274,7 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView) : m_pDocView(pDocView), m_pDrawingArea(gtk_drawing_area_new()), - m_aTileBuffer(TileBuffer(0,0,0)), + m_aTileBuffer(TileBuffer(0,0)), m_fZoom(1), m_pOffice(0), m_pDocument(0), @@ -1230,13 +1230,11 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView, long nDocumentHeightTwips = pDocView->m_pImpl->m_nDocumentHeightTwips; long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips, zoom); long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips, zoom); - // Total number of rows / columns in this document. - guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + // Total number of columns in this document. guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, - nRows, nColumns); gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, nDocumentWidthPixels, @@ -1257,12 +1255,10 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ pDocView->m_pImpl->m_fZoom = fZoom; long nDocumentWidthPixels = twipToPixel(pDocView->m_pImpl->m_nDocumentWidthTwips, fZoom); long nDocumentHeightPixels = twipToPixel(pDocView->m_pImpl->m_nDocumentHeightTwips, fZoom); - // Total number of rows / columns in this document. - guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); + // Total number of columns in this document. guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument, - nRows, nColumns); gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, nDocumentWidthPixels, diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx index ea8e524..b9bf71b 100644 --- a/libreofficekit/source/gtk/tilebuffer.hxx +++ b/libreofficekit/source/gtk/tilebuffer.hxx @@ -83,11 +83,9 @@ class TileBuffer { public: TileBuffer(LibreOfficeKitDocument *document, - int rows, int columns) : m_pLOKDocument(document) , m_nWidth(columns) - , m_nHeight(rows) { } ~TileBuffer() {} @@ -126,8 +124,6 @@ class TileBuffer std::map<int, Tile> m_mTiles; /// Width of the current tile buffer (number of columns) int m_nWidth; - /// Height of the current tile buffer (numbero of rows) - int m_nHeight; }; #endif // INCLUDED_TILEBUFFER_HXX commit 9805ae85eb776fa8f718c1415942c31f2cfc6d9e Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Jun 9 12:07:37 2015 +0200 sfx2: silence warning in SfxObjectShell::CopyStoragesOfUnknownMediaType() I guess the intention is to catch all "own" formats, and Base is just missing from that list. Change-Id: I064068c2ab17db9109a9a4681775ba8d18292292 diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index d431a1e..826d024 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -3484,6 +3484,7 @@ bool SfxObjectShell::CopyStoragesOfUnknownMediaType( const uno::Reference< embed case SotClipboardFormatId::STARCALC_8: case SotClipboardFormatId::STARCHART_8: case SotClipboardFormatId::STARMATH_8: + case SotClipboardFormatId::STARBASE_8: break; default: commit 2d7ff7aabc1aa8cf5bb4900ae4b00feb8bc0f7f7 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Jun 9 11:40:02 2015 +0200 SwDocShell: custom copy for embedded data source definition on save-as If "EmbeddedDatabase" in test.odt refers test.ods in the same directory, that will be "../../test.ods". Now if we save test.odt in a different directory, we need to re-save the embedded data source definition, otherwise the relative reference will resolve to a non-existing path. Relative references are normally not supported for embedded objects, so this is not a problem, but for data sources they are, that's why they are a special case here. Change-Id: Id138b9cdc38f2de589d9b80c66f1a61174699770 diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 666f0ac..d3f08e4 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1009,6 +1009,14 @@ void SwUiWriterTest::testEmbeddedDataSource() CPPUNIT_ASSERT(mxComponent.is()); CPPUNIT_ASSERT(xDatabaseContext->hasByName("calc-data-source")); + // Data source has a table named Sheet1 after saving to a different directory. + xDataSource.set(xDatabaseContext->getByName("calc-data-source"), uno::UNO_QUERY); + CPPUNIT_ASSERT(xDataSource.is()); + xConnection.set(xDataSource->getConnection("", ""), uno::UNO_QUERY); + xTables.set(xConnection->getTables(), uno::UNO_QUERY); + CPPUNIT_ASSERT(xTables.is()); + CPPUNIT_ASSERT(xTables->hasByName("Sheet1")); + // Close: should not have a data source anymore. mxComponent->dispose(); mxComponent.clear(); diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index b4c22ac..1901355 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -115,12 +115,15 @@ #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/sdb/DatabaseContext.hpp> +#include <com/sun/star/sdb/XDocumentDataSource.hpp> #include <unomid.h> #include <unotextrange.hxx> #include <sfx2/Metadatable.hxx> #include <calbck.hxx> +#include <dbmgr.hxx> #include <sal/log.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> @@ -416,6 +419,24 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) } CalcLayoutForOLEObjects(); // format for OLE objets + + if (!m_pDoc->GetDBManager()->getEmbeddedName().isEmpty()) + { + // We have an embedded data source definition, need to re-store it, + // otherwise relative references will break when the new file is in a + // different directory. + uno::Reference<sdb::XDatabaseContext> xDatabaseContext = sdb::DatabaseContext::create(comphelper::getProcessComponentContext()); + + const INetURLObject& rOldURLObject = GetMedium()->GetURLObject(); + OUString aURL = "vnd.sun.star.pkg://"; + aURL += INetURLObject::encode(rOldURLObject.GetMainURL(INetURLObject::DECODE_WITH_CHARSET), INetURLObject::PART_AUTHORITY, INetURLObject::ENCODE_ALL); + aURL += "/" + INetURLObject::encode(m_pDoc->GetDBManager()->getEmbeddedName(), INetURLObject::PART_FPATH, INetURLObject::ENCODE_ALL); + + uno::Reference<sdb::XDocumentDataSource> xDataSource(xDatabaseContext->getByName(aURL), uno::UNO_QUERY); + uno::Reference<frame::XStorable> xStorable(xDataSource->getDatabaseDocument(), uno::UNO_QUERY); + SwDBManager::StoreEmbeddedDataSource(xStorable, rMedium.GetOutputStorage(), m_pDoc->GetDBManager()->getEmbeddedName(), rMedium.GetName()); + } + // #i62875# // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible if (m_pWrtShell && commit f01f31201f9b26b3071ab25f9a5a3a0311ff7423 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Jun 9 09:42:40 2015 +0200 SwDBManager: extract StoreEmbeddedDataSource() from registration code Change-Id: Ifc6471f58793cde057f354c4c6a549c073b7d34b diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx index 007755d..5bf1542 100644 --- a/sw/inc/dbmgr.hxx +++ b/sw/inc/dbmgr.hxx @@ -28,6 +28,8 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/embed/XStorage.hpp> #include <boost/ptr_container/ptr_vector.hpp> namespace com{namespace sun{namespace star{ @@ -414,6 +416,11 @@ public: void setEmbeddedName(const OUString& rEmbeddedName, SwDocShell& rDocShell); OUString getEmbeddedName() const; + + static void StoreEmbeddedDataSource(const css::uno::Reference<css::frame::XStorable>& xStorable, + const css::uno::Reference<css::embed::XStorage>& xStorage, + const OUString& rStreamRelPath, + const OUString& rOwnURL); }; #endif diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index db52e41..ccd1372 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -2595,39 +2595,23 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const uno::Reference<frame::XStorable> xStore(xDS->getDatabaseDocument(), uno::UNO_QUERY_THROW); OUString sOutputExt = ".odb"; OUString aOwnURL = lcl_getOwnURL(pDocShell); - OUString sTmpName; - uno::Sequence<beans::PropertyValue> aSequence; if (aOwnURL.isEmpty()) { // Cannot embed, as embedded data source would need the URL of the parent document. OUString sHomePath(SvtPathOptions().GetWorkPath()); utl::TempFile aTempFile(sNewName, true, &sOutputExt, pDestDir ? pDestDir : &sHomePath); aTempFile.EnableKillingFile(true); - sTmpName = aTempFile.GetURL(); + OUString sTmpName = aTempFile.GetURL(); + xStore->storeAsURL(sTmpName, uno::Sequence<beans::PropertyValue>()); } else { - // Embed: construct vnd.sun.star.pkg:// URL for later loading, and TargetStorage/StreamRelPath for storing. + // Embed. OUString aStreamRelPath = "EmbeddedDatabase"; - sTmpName = "vnd.sun.star.pkg://"; - sTmpName += INetURLObject::encode(aOwnURL, INetURLObject::PART_AUTHORITY, INetURLObject::ENCODE_ALL); - sTmpName += "/" + aStreamRelPath; uno::Reference<embed::XStorage> xStorage = pDocShell->GetStorage(); - aSequence = comphelper::InitPropertySequence( - { - {"TargetStorage", uno::makeAny(xStorage)}, - {"StreamRelPath", uno::makeAny(aStreamRelPath)}, - {"BaseURI", uno::makeAny(aOwnURL)} - }); - - // Refer to the sub-storage name in the document settings, so - // we can load it again next time the file is imported. - uno::Reference<lang::XMultiServiceFactory> xFactory(pDocShell->GetModel(), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xPropertySet(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); - xPropertySet->setPropertyValue("EmbeddedDatabaseName", uno::makeAny(aStreamRelPath)); + SwDBManager::StoreEmbeddedDataSource(xStore, xStorage, aStreamRelPath, aOwnURL); } - xStore->storeAsURL(sTmpName, aSequence); } xDBContext->registerObject( sFind, xNewInstance ); } @@ -2638,6 +2622,25 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const return sFind; } +void SwDBManager::StoreEmbeddedDataSource(const uno::Reference<frame::XStorable>& xStorable, + const uno::Reference<embed::XStorage>& xStorage, + const OUString& rStreamRelPath, + const OUString& rOwnURL) +{ + // Construct vnd.sun.star.pkg:// URL for later loading, and TargetStorage/StreamRelPath for storing. + OUString sTmpName = "vnd.sun.star.pkg://"; + sTmpName += INetURLObject::encode(rOwnURL, INetURLObject::PART_AUTHORITY, INetURLObject::ENCODE_ALL); + sTmpName += "/" + rStreamRelPath; + + uno::Sequence<beans::PropertyValue> aSequence = comphelper::InitPropertySequence( + { + {"TargetStorage", uno::makeAny(xStorage)}, + {"StreamRelPath", uno::makeAny(rStreamRelPath)}, + {"BaseURI", uno::makeAny(rOwnURL)} + }); + xStorable->storeAsURL(sTmpName, aSequence); +} + OUString SwDBManager::LoadAndRegisterDataSource(const OUString &rURI, const OUString *pPrefix, const OUString *pDestDir, const uno::Reference< beans::XPropertySet > *pSettings) { commit 2a0dda3dfb37f0cb69842f7d569c253d82f53713 Author: Noel Grandin <n...@peralex.com> Date: Tue Jun 9 08:52:12 2015 +0200 remove some unnecessary exception wrapping in the Java tests Modify createTestEnvironment so that it throws Exception. This is appropriate for unit testing. The wrapping adds no value and the calling method already has a catch(Exception) to handle anything. Change-Id: I430a414f63d2cbfc3b65ecfde0285509265e5192 diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java index 6baee75..297469b 100644 --- a/dbaccess/qa/complex/dbaccess/RowSet.java +++ b/dbaccess/qa/complex/dbaccess/RowSet.java @@ -17,7 +17,6 @@ */ package complex.dbaccess; -import com.sun.star.beans.PropertyVetoException; import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XIndexAccess; diff --git a/qadevOOo/runner/lib/TestCase.java b/qadevOOo/runner/lib/TestCase.java index ebe175d..3a3d7e9 100644 --- a/qadevOOo/runner/lib/TestCase.java +++ b/qadevOOo/runner/lib/TestCase.java @@ -157,7 +157,7 @@ public abstract class TestCase { * @see #getTestEnvironment */ protected abstract TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log ); + TestParameters tParam, PrintWriter log ) throws Exception; /** * @return the name of the object diff --git a/qadevOOo/tests/java/mod/_acceptor/Acceptor.java b/qadevOOo/tests/java/mod/_acceptor/Acceptor.java index 0a2a04e..662212c 100644 --- a/qadevOOo/tests/java/mod/_acceptor/Acceptor.java +++ b/qadevOOo/tests/java/mod/_acceptor/Acceptor.java @@ -20,7 +20,6 @@ package mod._acceptor; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -76,18 +75,14 @@ public class Acceptor extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { XInterface oObj = null; XInterface acceptor = null; - try { - acceptor = (XInterface) - Param.getMSF().createInstance - ("com.sun.star.connection.Acceptor"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object environment", e) ; - } + acceptor = (XInterface) + Param.getMSF().createInstance + ("com.sun.star.connection.Acceptor"); // select the port curPort = utils.getNextFreePort(basePort); diff --git a/qadevOOo/tests/java/mod/_acceptor/uno/Acceptor.java b/qadevOOo/tests/java/mod/_acceptor/uno/Acceptor.java index 8648ad5..b73c31a 100644 --- a/qadevOOo/tests/java/mod/_acceptor/uno/Acceptor.java +++ b/qadevOOo/tests/java/mod/_acceptor/uno/Acceptor.java @@ -20,7 +20,6 @@ package mod._acceptor.uno; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -71,25 +70,17 @@ public class Acceptor extends TestCase { * <ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - XInterface acceptor = null; - - try { - acceptor = (XInterface) - Param.getMSF().createInstance - ("com.sun.star.connection.Acceptor"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object environment", e) ; - } + XInterface acceptor = (XInterface) + Param.getMSF().createInstance + ("com.sun.star.connection.Acceptor"); // select the port curPort = utils.getNextFreePort(basePort); log.println("Choose Port nr: " + curPort); - oObj = acceptor; - TestEnvironment tEnv = new TestEnvironment(oObj) ; + TestEnvironment tEnv = new TestEnvironment(acceptor) ; // adding connection string as relation tEnv.addObjRelation("XAcceptor.connectStr", diff --git a/qadevOOo/tests/java/mod/_adabas/ODriver.java b/qadevOOo/tests/java/mod/_adabas/ODriver.java index 0f3b56e..2ac7ecd 100644 --- a/qadevOOo/tests/java/mod/_adabas/ODriver.java +++ b/qadevOOo/tests/java/mod/_adabas/ODriver.java @@ -59,16 +59,10 @@ public class ODriver extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF(). - createInstance("com.sun.star.comp.sdbcx.adabas.ODriver"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create object")); - } + XInterface oObj = (XInterface)Param.getMSF(). + createInstance("com.sun.star.comp.sdbcx.adabas.ODriver"); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_ado/ODriver.java b/qadevOOo/tests/java/mod/_ado/ODriver.java index 7e5518c..ef1cfc7 100644 --- a/qadevOOo/tests/java/mod/_ado/ODriver.java +++ b/qadevOOo/tests/java/mod/_ado/ODriver.java @@ -58,16 +58,10 @@ public class ODriver extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF(). - createInstance("com.sun.star.comp.sdbc.ado.ODriver"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create object")); - } + XInterface oObj = (XInterface)Param.getMSF(). + createInstance("com.sun.star.comp.sdbc.ado.ODriver"); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_basctl/AccessibleShape.java b/qadevOOo/tests/java/mod/_basctl/AccessibleShape.java index daac55c..103dca483 100644 --- a/qadevOOo/tests/java/mod/_basctl/AccessibleShape.java +++ b/qadevOOo/tests/java/mod/_basctl/AccessibleShape.java @@ -35,7 +35,6 @@ import com.sun.star.text.XTextDocument; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -64,7 +63,7 @@ public class AccessibleShape extends TestCase { } @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); log.println( "creating a test environment" ); String aURL=utils.getFullTestURL("basDialog.odt"); @@ -74,37 +73,27 @@ public class AccessibleShape extends TestCase { XDispatchProvider xDPP = UnoRuntime.queryInterface(XDispatchProvider.class, xFrame); log.println( "opening the basic dialog editor" ); - try { - Object o = xMSF.createInstance("com.sun.star.frame.DispatchHelper"); - XDispatchHelper xDPH = UnoRuntime.queryInterface(XDispatchHelper.class, o); - PropertyValue[] aArgs = new PropertyValue[4]; - aArgs[0] = new PropertyValue(); - aArgs[0].Name = "Document"; - aArgs[0].Value = aURL; - aArgs[1] = new PropertyValue(); - aArgs[1].Name = "LibName"; - aArgs[1].Value = "basctl"; - aArgs[2] = new PropertyValue(); - aArgs[2].Name = "Name"; - aArgs[2].Value = "Dialog1"; - aArgs[3] = new PropertyValue(); - aArgs[3].Name = "Type"; - aArgs[3].Value = "Dialog"; - xDPH.executeDispatch(xDPP, ".uno:BasicIDEAppear", "", 0, aArgs); - } catch (Exception e) { - throw new StatusException("Couldn't open Basic Dialog",e); - } + Object o = xMSF.createInstance("com.sun.star.frame.DispatchHelper"); + XDispatchHelper xDPH = UnoRuntime.queryInterface(XDispatchHelper.class, o); + PropertyValue[] aArgs = new PropertyValue[4]; + aArgs[0] = new PropertyValue(); + aArgs[0].Name = "Document"; + aArgs[0].Value = aURL; + aArgs[1] = new PropertyValue(); + aArgs[1].Name = "LibName"; + aArgs[1].Value = "basctl"; + aArgs[2] = new PropertyValue(); + aArgs[2].Name = "Name"; + aArgs[2].Value = "Dialog1"; + aArgs[3] = new PropertyValue(); + aArgs[3].Name = "Type"; + aArgs[3].Value = "Dialog"; + xDPH.executeDispatch(xDPP, ".uno:BasicIDEAppear", "", 0, aArgs); utils.pause(3000); - try { - oObj = (XInterface) tParam.getMSF().createInstance - ("com.sun.star.awt.Toolkit") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e ); - } + oObj = (XInterface) tParam.getMSF().createInstance + ("com.sun.star.awt.Toolkit") ; final XWindow basicIDE = xFrame.getContainerWindow(); diff --git a/qadevOOo/tests/java/mod/_brdgfctr/BridgeFactory.java b/qadevOOo/tests/java/mod/_brdgfctr/BridgeFactory.java index fafddfb..5cc1c49 100644 --- a/qadevOOo/tests/java/mod/_brdgfctr/BridgeFactory.java +++ b/qadevOOo/tests/java/mod/_brdgfctr/BridgeFactory.java @@ -68,16 +68,10 @@ public class BridgeFactory extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { - XInterface oObj = null ; - - try { - oObj = (XInterface) Param.getMSF().createInstance + XInterface oObj = (XInterface) Param.getMSF().createInstance ("com.sun.star.bridge.BridgeFactory") ; - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object environment", e) ; - } if (oObj == null) throw new StatusException("Can't create service", diff --git a/qadevOOo/tests/java/mod/_bridgefac/uno/BridgeFactory.java b/qadevOOo/tests/java/mod/_bridgefac/uno/BridgeFactory.java index 337da35..f4d1148 100644 --- a/qadevOOo/tests/java/mod/_bridgefac/uno/BridgeFactory.java +++ b/qadevOOo/tests/java/mod/_bridgefac/uno/BridgeFactory.java @@ -65,17 +65,11 @@ public class BridgeFactory extends TestCase { * service as object to be tested. */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null ; - - try { - oObj = (XInterface) + XInterface oObj = (XInterface) Param.getMSF().createInstance ("com.sun.star.bridge.BridgeFactory") ; - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object environment", e) ; - } if (oObj == null) throw new StatusException("Can't create service", diff --git a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java index 4596c7f..d2a2dbc 100644 --- a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java +++ b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java @@ -79,89 +79,71 @@ public class CachedContentResultSetFactory extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - try { - oInterface = xMSF.createInstance + Object oInterface = xMSF.createInstance ( "com.sun.star.ucb.CachedContentResultSetFactory" ); - - // adding one child container - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); // creating relation for XCachedContentResultSetFactory XResultSet resSetStub = null ; - try { - Object oUCB = xMSF.createInstanceWithArguments - ("com.sun.star.ucb.UniversalContentBroker", - new Object[0]) ; - - XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; - - String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; - String escUrl = "" ; - - // In base URL of a JAR file in content URL all directory - // separators ('/') must be replaced with escape symbol '%2F'. - int idx = url.indexOf("/") ; - int lastIdx = -1 ; - while (idx >= 0) { - escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; - lastIdx = idx ; - idx = url.indexOf("/", idx + 1) ; - } - escUrl += url.substring(lastIdx + 1) ; - String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; - - XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; + Object oUCB = xMSF.createInstanceWithArguments + ("com.sun.star.ucb.UniversalContentBroker", + new Object[0]) ; + + XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; + + String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; + String escUrl = "" ; + + // In base URL of a JAR file in content URL all directory + // separators ('/') must be replaced with escape symbol '%2F'. + int idx = url.indexOf("/") ; + int lastIdx = -1 ; + while (idx >= 0) { + escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; + lastIdx = idx ; + idx = url.indexOf("/", idx + 1) ; + } + escUrl += url.substring(lastIdx + 1) ; + String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; - XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; + XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; - XContent cnt = cntProv.queryContent(CI) ; + XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; - XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; + XContent cnt = cntProv.queryContent(CI) ; - Property prop = new Property() ; - prop.Name = "Title" ; + XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; - Command cmd = new Command("open", -1, new OpenCommandArgument2 - (OpenMode.ALL, 10000, null, new Property[] {prop}, - new NumberedSortingInfo[0])) ; + Property prop = new Property() ; + prop.Name = "Title" ; - XDynamicResultSet dynResSet = null; - try { - dynResSet = (XDynamicResultSet) - AnyConverter.toObject(new Type(XDynamicResultSet.class), - cmdProc.execute(cmd, 0, null)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("Couldn't convert Any ",iae); - } + Command cmd = new Command("open", -1, new OpenCommandArgument2 + (OpenMode.ALL, 10000, null, new Property[] {prop}, + new NumberedSortingInfo[0])) ; - XResultSet resSet = dynResSet.getStaticResultSet() ; + XDynamicResultSet dynResSet = null; + try { + dynResSet = (XDynamicResultSet) + AnyConverter.toObject(new Type(XDynamicResultSet.class), + cmdProc.execute(cmd, 0, null)); + } catch (com.sun.star.lang.IllegalArgumentException iae) { + throw new StatusException("Couldn't convert Any ",iae); + } - Object oStubFactory = xMSF.createInstance - ("com.sun.star.ucb.CachedContentResultSetStubFactory") ; + XResultSet resSet = dynResSet.getStaticResultSet() ; - XCachedContentResultSetStubFactory xStubFactory = - UnoRuntime.queryInterface - (XCachedContentResultSetStubFactory.class, oStubFactory) ; + Object oStubFactory = xMSF.createInstance + ("com.sun.star.ucb.CachedContentResultSetStubFactory") ; - resSetStub = xStubFactory.createCachedContentResultSetStub(resSet) ; + XCachedContentResultSetStubFactory xStubFactory = + UnoRuntime.queryInterface + (XCachedContentResultSetStubFactory.class, oStubFactory) ; - } catch (com.sun.star.uno.Exception e) { - log.println("Can't create relation." ); - e.printStackTrace(log) ; - throw new StatusException( "Can't create relation", e ); - } + resSetStub = xStubFactory.createCachedContentResultSetStub(resSet) ; tEnv.addObjRelation("CachedContentResultSetStub", resSetStub) ; diff --git a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java index 42d3c9a..8dd3b15 100644 --- a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java +++ b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java @@ -77,82 +77,64 @@ public class CachedContentResultSetStubFactory extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - try { - oInterface = xMSF.createInstance + Object oInterface = xMSF.createInstance ( "com.sun.star.ucb.CachedContentResultSetStubFactory" ); - - // adding one child container - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); // creating relation for XCachedContentResultSetStubFactory XResultSet resSet = null ; + Object oUCB = xMSF.createInstanceWithArguments + ("com.sun.star.ucb.UniversalContentBroker", + new Object[0]) ; + + XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; + + String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; + String escUrl = "" ; + + // In base URL of a JAR file in content URL all directory + // separators ('/') must be replaced with escape symbol '%2F'. + int idx = url.indexOf("/") ; + int lastIdx = -1 ; + while (idx >= 0) { + escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; + lastIdx = idx ; + idx = url.indexOf("/", idx + 1) ; + } + escUrl += url.substring(lastIdx + 1) ; + String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; + log.println("Getting Content of '" + cntUrl + "'") ; + + XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; + + XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; + + XContent cnt = cntProv.queryContent(CI) ; + + XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; + + Property prop = new Property() ; + prop.Name = "Title" ; + + Command cmd = new Command("open", -1, new OpenCommandArgument2 + (OpenMode.ALL, 10000, null, new Property[] {prop}, + new NumberedSortingInfo[0])) ; + + XDynamicResultSet dynResSet = null; try { - Object oUCB = xMSF.createInstanceWithArguments - ("com.sun.star.ucb.UniversalContentBroker", - new Object[0]) ; - - XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; - - String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; - String escUrl = "" ; - - // In base URL of a JAR file in content URL all directory - // separators ('/') must be replaced with escape symbol '%2F'. - int idx = url.indexOf("/") ; - int lastIdx = -1 ; - while (idx >= 0) { - escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; - lastIdx = idx ; - idx = url.indexOf("/", idx + 1) ; - } - escUrl += url.substring(lastIdx + 1) ; - String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; - log.println("Getting Content of '" + cntUrl + "'") ; - - XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; - - XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; - - XContent cnt = cntProv.queryContent(CI) ; - - XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; - - Property prop = new Property() ; - prop.Name = "Title" ; - - Command cmd = new Command("open", -1, new OpenCommandArgument2 - (OpenMode.ALL, 10000, null, new Property[] {prop}, - new NumberedSortingInfo[0])) ; - - XDynamicResultSet dynResSet = null; - try { - dynResSet = (XDynamicResultSet) - AnyConverter.toObject(new Type(XDynamicResultSet.class), - cmdProc.execute(cmd, 0, null)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("Couldn't convert Any ",iae); - } - - resSet = dynResSet.getStaticResultSet() ; - - } catch (com.sun.star.uno.Exception e) { - log.println("Can't create relation." ); - e.printStackTrace(log) ; - throw new StatusException( "Can't create relation", e ); + dynResSet = (XDynamicResultSet) + AnyConverter.toObject(new Type(XDynamicResultSet.class), + cmdProc.execute(cmd, 0, null)); + } catch (com.sun.star.lang.IllegalArgumentException iae) { + throw new StatusException("Couldn't convert Any ",iae); } + resSet = dynResSet.getStaticResultSet() ; + tEnv.addObjRelation("ContentResultSet", resSet) ; return tEnv; diff --git a/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java b/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java index c2ba76d..d2435b9 100644 --- a/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java +++ b/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java @@ -36,7 +36,6 @@ import com.sun.star.uno.XInterface; import com.sun.star.uno.Type; import com.sun.star.uno.AnyConverter; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -77,88 +76,65 @@ public class CachedDynamicResultSetFactory extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - try { - oInterface = xMSF.createInstance + Object oInterface = xMSF.createInstance ( "com.sun.star.ucb.CachedDynamicResultSetFactory" ); - - // adding one child container - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); // creating relation for XCachedDynamicResultSetFactory XDynamicResultSet resSetStub = null ; - try { - Object oUCB = xMSF.createInstanceWithArguments - ("com.sun.star.ucb.UniversalContentBroker", - new Object[0]) ; - - XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; - - String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; - String escUrl = "" ; - - // In base URL of a JAR file in content URL all directory - // separators ('/') must be replaced with escape symbol '%2F'. - int idx = url.indexOf("/") ; - int lastIdx = -1 ; - while (idx >= 0) { - escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; - lastIdx = idx ; - idx = url.indexOf("/", idx + 1) ; - } - escUrl += url.substring(lastIdx + 1) ; - String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; - - XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; - - XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; - - XContent cnt = cntProv.queryContent(CI) ; - - XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; - - Property prop = new Property() ; - prop.Name = "Title" ; - - Command cmd = new Command("open", -1, new OpenCommandArgument2 - (OpenMode.ALL, 10000, null, new Property[] {prop}, - new NumberedSortingInfo[0])) ; - - XDynamicResultSet dynResSet = null; - try { - dynResSet = (XDynamicResultSet) - AnyConverter.toObject(new Type(XDynamicResultSet.class), - cmdProc.execute(cmd, 0, null)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("Couldn't convert Any ",iae); - } - - Object oStubFactory = xMSF.createInstance - ("com.sun.star.ucb.CachedDynamicResultSetStubFactory") ; - - XCachedDynamicResultSetStubFactory xStubFactory = - UnoRuntime.queryInterface - (XCachedDynamicResultSetStubFactory.class, oStubFactory) ; - - resSetStub = - xStubFactory.createCachedDynamicResultSetStub(dynResSet) ; - - } catch (com.sun.star.uno.Exception e) { - log.println("Can't create relation." ); - e.printStackTrace(log) ; - throw new StatusException( "Can't create relation", e ); + Object oUCB = xMSF.createInstanceWithArguments + ("com.sun.star.ucb.UniversalContentBroker", + new Object[0]) ; + + XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; + + String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; + String escUrl = "" ; + + // In base URL of a JAR file in content URL all directory + // separators ('/') must be replaced with escape symbol '%2F'. + int idx = url.indexOf("/") ; + int lastIdx = -1 ; + while (idx >= 0) { + escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; + lastIdx = idx ; + idx = url.indexOf("/", idx + 1) ; } + escUrl += url.substring(lastIdx + 1) ; + String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; + + XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; + + XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; + + XContent cnt = cntProv.queryContent(CI) ; + + XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; + + Property prop = new Property() ; + prop.Name = "Title" ; + + Command cmd = new Command("open", -1, new OpenCommandArgument2 + (OpenMode.ALL, 10000, null, new Property[] {prop}, + new NumberedSortingInfo[0])) ; + + XDynamicResultSet dynResSet = (XDynamicResultSet) + AnyConverter.toObject(new Type(XDynamicResultSet.class), + cmdProc.execute(cmd, 0, null)); + + Object oStubFactory = xMSF.createInstance + ("com.sun.star.ucb.CachedDynamicResultSetStubFactory") ; + + XCachedDynamicResultSetStubFactory xStubFactory = + UnoRuntime.queryInterface + (XCachedDynamicResultSetStubFactory.class, oStubFactory) ; + + resSetStub = + xStubFactory.createCachedDynamicResultSetStub(dynResSet) ; tEnv.addObjRelation("CachedDynamicResultSetStub", resSetStub) ; diff --git a/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java b/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java index deec884..a0245b7 100644 --- a/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java +++ b/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java @@ -35,7 +35,6 @@ import com.sun.star.uno.XInterface; import com.sun.star.uno.Type; import com.sun.star.uno.AnyConverter; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -74,77 +73,55 @@ public class CachedDynamicResultSetStubFactory extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - try { - oInterface = xMSF.createInstance + Object oInterface = xMSF.createInstance ( "com.sun.star.ucb.CachedDynamicResultSetStubFactory" ); - - // adding one child container - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); // creating relation for XCachedDynamicResultSetStubFactory XDynamicResultSet dynResSet = null ; - try { - Object oUCB = xMSF.createInstanceWithArguments - ("com.sun.star.ucb.UniversalContentBroker", - new Object[0]) ; - - XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; - - String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; - String escUrl = "" ; - - // In base URL of a JAR file in content URL all directory - // separators ('/') must be replaced with escape symbol '%2F'. - int idx = url.indexOf("/") ; - int lastIdx = -1 ; - while (idx >= 0) { - escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; - lastIdx = idx ; - idx = url.indexOf("/", idx + 1) ; - } - escUrl += url.substring(lastIdx + 1) ; - String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; - - XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; - - XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; - - XContent cnt = cntProv.queryContent(CI) ; - - XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; - - Property prop = new Property() ; - prop.Name = "Title" ; - - Command cmd = new Command("open", -1, new OpenCommandArgument2 - (OpenMode.ALL, 10000, null, new Property[] {prop}, - new NumberedSortingInfo[0])) ; - - try { - dynResSet = (XDynamicResultSet) - AnyConverter.toObject(new Type(XDynamicResultSet.class), - cmdProc.execute(cmd, 0, null)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("Couldn't convert Any ",iae); - } - - } catch (com.sun.star.uno.Exception e) { - log.println("Can't create relation." ); - e.printStackTrace(log) ; - throw new StatusException( "Can't create relation", e ); + Object oUCB = xMSF.createInstanceWithArguments + ("com.sun.star.ucb.UniversalContentBroker", + new Object[0]) ; + + XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; + + String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; + String escUrl = "" ; + + // In base URL of a JAR file in content URL all directory + // separators ('/') must be replaced with escape symbol '%2F'. + int idx = url.indexOf("/") ; + int lastIdx = -1 ; + while (idx >= 0) { + escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; + lastIdx = idx ; + idx = url.indexOf("/", idx + 1) ; } + escUrl += url.substring(lastIdx + 1) ; + String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; + + XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; + + XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; + + XContent cnt = cntProv.queryContent(CI) ; + + XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; + + Property prop = new Property() ; + prop.Name = "Title" ; + + Command cmd = new Command("open", -1, new OpenCommandArgument2 + (OpenMode.ALL, 10000, null, new Property[] {prop}, + new NumberedSortingInfo[0])) ; + + dynResSet = (XDynamicResultSet) + AnyConverter.toObject(new Type(XDynamicResultSet.class), + cmdProc.execute(cmd, 0, null)); tEnv.addObjRelation("DynamicResultSet", dynResSet) ; diff --git a/qadevOOo/tests/java/mod/_cmdmail/SimpleCommandMail.java b/qadevOOo/tests/java/mod/_cmdmail/SimpleCommandMail.java index 5988517..0465576 100644 --- a/qadevOOo/tests/java/mod/_cmdmail/SimpleCommandMail.java +++ b/qadevOOo/tests/java/mod/_cmdmail/SimpleCommandMail.java @@ -20,7 +20,6 @@ package mod._cmdmail; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -33,23 +32,13 @@ public class SimpleCommandMail extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance ( "com.sun.star.comp.system.SimpleCommandMail" ); - if (oInterface == null) log.println("!!! NULL !!!") ; - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + if (oInterface == null) log.println("!!! NULL !!!") ; + XInterface oObj = (XInterface) oInterface; log.println("ImplementationName: "+util.utils.getImplName(oObj)); diff --git a/qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java b/qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java index b2f60ed..3d83380 100644 --- a/qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java +++ b/qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java @@ -20,7 +20,6 @@ package mod._cnt; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -66,24 +65,13 @@ public class ChaosContentProvider extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - Object cntFactory = null ; - - try { - oInterface = xMSF.createInstance + Object oInterface = xMSF.createInstance ( "com.sun.star.ucb.ChaosContentProvider" ); - cntFactory = xMSF.createInstance + Object cntFactory = xMSF.createInstance ( "com.sun.star.comp.ucb.UniversalContentBroker" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java b/qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java index ee7aebf..8fc8cd0 100644 --- a/qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java +++ b/qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java @@ -20,7 +20,6 @@ package mod._cnt; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -79,37 +78,27 @@ public class CntUnoDataContainer extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null; + TestParameters Param, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - Object relationContainer = null ; - Object xIn = null; - try { - oInterface = xMSF.createInstance - ( "com.sun.star.ucb.DataContainer" ); + Object oInterface = xMSF.createInstance + ( "com.sun.star.ucb.DataContainer" ); - // adding one child container - XIndexContainer xIC = UnoRuntime.queryInterface - (XIndexContainer.class, oInterface) ; + // adding one child container + XIndexContainer xIC = UnoRuntime.queryInterface + (XIndexContainer.class, oInterface) ; - Object child = xMSF.createInstance - ( "com.sun.star.ucb.DataContainer" ); - xIC.insertByIndex(0, child) ; + Object child = xMSF.createInstance + ( "com.sun.star.ucb.DataContainer" ); + xIC.insertByIndex(0, child) ; - relationContainer = xMSF.createInstance - ( "com.sun.star.ucb.DataContainer" ); + Object relationContainer = xMSF.createInstance + ( "com.sun.star.ucb.DataContainer" ); - xIn = xMSF.createInstance - ( "com.sun.star.io.DataInputStream" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + Object xIn = xMSF.createInstance + ( "com.sun.star.io.DataInputStream" ); - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java b/qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java index 61ada8c..93807fe 100644 --- a/qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java +++ b/qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java @@ -20,7 +20,6 @@ package mod._cnt; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -51,23 +50,11 @@ public class PropertyMatcherFactory extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - - - try { - oInterface = xMSF.createInstance - ( "com.sun.star.ucb.PropertyMatcherFactory" ); - - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + Object oInterface = xMSF.createInstance + ( "com.sun.star.ucb.PropertyMatcherFactory" ); + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_configmgr/ConfigurationProvider.java b/qadevOOo/tests/java/mod/_configmgr/ConfigurationProvider.java index df544e3..dc11480 100644 --- a/qadevOOo/tests/java/mod/_configmgr/ConfigurationProvider.java +++ b/qadevOOo/tests/java/mod/_configmgr/ConfigurationProvider.java @@ -29,20 +29,16 @@ public final class ConfigurationProvider extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) + TestParameters tParam, PrintWriter log) throws Exception { // Create a non-default ConfigurationProvider instance, so that testing // its XComponent.dispose does not accidentally dispose the // DefaultProvider: XComponentContext ctxt = tParam.getComponentContext(); - try { return ProviderTestEnvironment.create( ctxt.getServiceManager().createInstanceWithArgumentsAndContext( "com.sun.star.configuration.ConfigurationProvider", new Object[] { new NamedValue("Locale", "*") }, ctxt)); - } catch (com.sun.star.uno.Exception e) { - throw new RuntimeException(e); - } } } diff --git a/qadevOOo/tests/java/mod/_configmgr/DefaultProvider.java b/qadevOOo/tests/java/mod/_configmgr/DefaultProvider.java index fb181d9..2a11a9b 100644 --- a/qadevOOo/tests/java/mod/_configmgr/DefaultProvider.java +++ b/qadevOOo/tests/java/mod/_configmgr/DefaultProvider.java @@ -32,13 +32,9 @@ public final class DefaultProvider extends TestCase { protected TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log) { - try { - return ProviderTestEnvironment.create( - AnyConverter.toObject( - XInterface.class, - theDefaultProvider.get(tParam.getComponentContext()))); - } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new RuntimeException(e); - } + return ProviderTestEnvironment.create( + AnyConverter.toObject( + XInterface.class, + theDefaultProvider.get(tParam.getComponentContext()))); } } diff --git a/qadevOOo/tests/java/mod/_connector/uno/Connector.java b/qadevOOo/tests/java/mod/_connector/uno/Connector.java index d6a9d43..16ea749 100644 --- a/qadevOOo/tests/java/mod/_connector/uno/Connector.java +++ b/qadevOOo/tests/java/mod/_connector/uno/Connector.java @@ -20,7 +20,6 @@ package mod._connector.uno; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -71,22 +70,13 @@ public class Connector extends TestCase { * Just creates service <code>com.sun.star.connection.Connector</code> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null ; + XInterface connector = (XInterface) + Param.getMSF().createInstance + ("com.sun.star.connection.Connector") ; - try { - XInterface connector = (XInterface) - Param.getMSF().createInstance - ("com.sun.star.connection.Connector") ; - - oObj = connector ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't create object environment", e); - } - - TestEnvironment tEnv = new TestEnvironment(oObj) ; + TestEnvironment tEnv = new TestEnvironment(connector) ; // select the port curPort = utils.getNextFreePort(basePort); diff --git a/qadevOOo/tests/java/mod/_connectr/Connector.java b/qadevOOo/tests/java/mod/_connectr/Connector.java index 4b02ff1..65fce09 100644 --- a/qadevOOo/tests/java/mod/_connectr/Connector.java +++ b/qadevOOo/tests/java/mod/_connectr/Connector.java @@ -20,7 +20,6 @@ package mod._connectr; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -74,22 +73,12 @@ public class Connector extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + TestParameters Param, PrintWriter log) throws Exception { + XInterface connector = (XInterface) + Param.getMSF().createInstance + ("com.sun.star.connection.Connector") ; - XInterface oObj = null ; - - try { - XInterface connector = (XInterface) - Param.getMSF().createInstance - ("com.sun.star.connection.Connector") ; - - oObj = connector ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't create object environment", e); - } - - TestEnvironment tEnv = new TestEnvironment(oObj) ; + TestEnvironment tEnv = new TestEnvironment(connector) ; // select the port curPort = utils.getNextFreePort(basePort); diff --git a/qadevOOo/tests/java/mod/_corefl/CoreReflection.java b/qadevOOo/tests/java/mod/_corefl/CoreReflection.java index 7513554..4363f2f 100644 --- a/qadevOOo/tests/java/mod/_corefl/CoreReflection.java +++ b/qadevOOo/tests/java/mod/_corefl/CoreReflection.java @@ -20,7 +20,6 @@ package mod._corefl; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -54,21 +53,11 @@ public class CoreReflection extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance + TestParameters Param, PrintWriter log) throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance ("com.sun.star.reflection.CoreReflection"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - log.println("CoreReflection Service not available" ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for CoreReflection object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_corereflection/uno/CoreReflection.java b/qadevOOo/tests/java/mod/_corereflection/uno/CoreReflection.java index 39ea97b..029ae30 100644 --- a/qadevOOo/tests/java/mod/_corereflection/uno/CoreReflection.java +++ b/qadevOOo/tests/java/mod/_corereflection/uno/CoreReflection.java @@ -50,21 +50,12 @@ public class CoreReflection extends TestCase { * Creates <code>com.sun.star.reflection.CoreReflection</code> service. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null; + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ("com.sun.star.reflection.CoreReflection"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - log.println("CoreReflection Service not available" ); - } - - oObj = (XInterface) oInterface; + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ("com.sun.star.reflection.CoreReflection"); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for CoreReflection object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_cpld/DLLComponentLoader.java b/qadevOOo/tests/java/mod/_cpld/DLLComponentLoader.java index 9b16c42..035068a 100644 --- a/qadevOOo/tests/java/mod/_cpld/DLLComponentLoader.java +++ b/qadevOOo/tests/java/mod/_cpld/DLLComponentLoader.java @@ -66,20 +66,12 @@ public class DLLComponentLoader extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null; + (TestParameters Param, PrintWriter log) throws Exception { - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.comp.stoc.DLLComponentLoader" ); - } - catch( Exception e ) { - log.println("DLLComponentLoader Service not available" ); - } - - oObj = (XInterface) oInterface; + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ( "com.sun.star.comp.stoc.DLLComponentLoader" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for DLLComponentLoader object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java b/qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java index bfffdfd..2025e9b 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java +++ b/qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java @@ -94,7 +94,7 @@ public class ConnectionLineAccessibility extends TestCase */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) + PrintWriter log) throws Exception { XInterface oObj = null; @@ -102,21 +102,10 @@ public class ConnectionLineAccessibility extends TestCase Object newQuery = null; XStorable store = null; - try - { - Param.getMSF() - .createInstance("com.sun.star.sdb.DatabaseContext"); - oDBSource = Param.getMSF() - .createInstance("com.sun.star.sdb.DataSource"); - newQuery = Param.getMSF() - .createInstance("com.sun.star.sdb.QueryDefinition"); - Param.getMSF() - .createInstance("com.sun.star.awt.Toolkit"); - } - catch (com.sun.star.uno.Exception e) - { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + Param.getMSF().createInstance("com.sun.star.sdb.DatabaseContext"); + oDBSource = Param.getMSF().createInstance("com.sun.star.sdb.DataSource"); + newQuery = Param.getMSF().createInstance("com.sun.star.sdb.QueryDefinition"); + Param.getMSF().createInstance("com.sun.star.awt.Toolkit"); String mysqlURL = (String) Param.get("mysql.url"); @@ -146,49 +135,19 @@ public class ConnectionLineAccessibility extends TestCase XPropertySet propSetDBSource = UnoRuntime.queryInterface( XPropertySet.class, oDBSource); - try - { - propSetDBSource.setPropertyValue("URL", mysqlURL); - propSetDBSource.setPropertyValue("Info", info); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - throw new StatusException(e, Status.failed( - "Couldn't set property value")); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - throw new StatusException(e, Status.failed( - "Couldn't set property value")); - } - catch (com.sun.star.beans.PropertyVetoException e) - { - throw new StatusException(e, Status.failed( - "Couldn't set property value")); - } - catch (com.sun.star.beans.UnknownPropertyException e) - { - throw new StatusException(e, Status.failed( - "Couldn't set property value")); - } + propSetDBSource.setPropertyValue("URL", mysqlURL); + propSetDBSource.setPropertyValue("Info", info); - try - { - log.println("writing database file ..."); - XDocumentDataSource xDDS = UnoRuntime.queryInterface(XDocumentDataSource.class, oDBSource); - store = UnoRuntime.queryInterface(XStorable.class, - xDDS.getDatabaseDocument()); - - aFile = utils.getOfficeTemp(Param.getMSF())+"ConnectionLine.odb"; - log.println("... filename will be "+aFile); - store.storeAsURL(aFile,new PropertyValue[] - {}); - log.println("... done"); - } - catch (com.sun.star.uno.Exception e) - { - throw new StatusException(e, Status.failed("Couldn't register object")); - } + log.println("writing database file ..."); + XDocumentDataSource xDDS = UnoRuntime.queryInterface(XDocumentDataSource.class, oDBSource); + store = UnoRuntime.queryInterface(XStorable.class, + xDDS.getDatabaseDocument()); + + aFile = utils.getOfficeTemp(Param.getMSF())+"ConnectionLine.odb"; + log.println("... filename will be "+aFile); + store.storeAsURL(aFile,new PropertyValue[] + {}); + log.println("... done"); isolConnection = UnoRuntime.queryInterface( XIsolatedConnection.class, @@ -215,8 +174,6 @@ public class ConnectionLineAccessibility extends TestCase } catch (com.sun.star.sdbc.SQLException e) { - try - { ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits