/*! Check if buffer contains data meant for this importer. We don't attmpt to recognize since other filetypes (HTML) can use the same encodings a text file can. We also don't want to steal recognition when user wants to use the Encoded Text importer. */ UT_Confidence_t IE_Imp_RDF_Sniffer::recognizeContents( const char * szBuf, UT_uint32 iNumbytes ) { UT_UNUSED( szBuf ); UT_UNUSED( iNumbytes ); return UT_CONFIDENCE_ZILCH; }
// // AbiPaint specify image editor // ------------------- // This is the function sets which image editor will (at least attempted) be invoked. // // parameters are: // AV_View* v // EV_EditMethodCallData *d) // static DECLARE_ABI_PLUGIN_METHOD(specify) { UT_UNUSED(v); UT_UNUSED(d); // get current value UT_String szProgramName = ""; prefsScheme->getValue(ABIPAINT_PREF_KEY_szProgramName, szProgramName); // Get a frame in case we need to show an error message XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame(); { const char * szDescList[3]; const char * szSuffixList[3]; int ft[3]; szDescList[0] = szProgramsDesc; szSuffixList[0] = szProgramSuffix; szDescList[1] = szSuffixList[1] = NULL; ft[0] = ft[1] = ft[2] = IEGFT_Unknown; if (getFileName(szProgramName, pFrame, XAP_DIALOG_ID_FILE_OPEN, szDescList, szSuffixList, ft)) return false; UT_DEBUGMSG(("ABIPAINT: szProgramName to use is %s\n", szProgramName.c_str())); } // now write it to the preference prefsScheme->setValue(ABIPAINT_PREF_KEY_szProgramName.c_str(), szProgramName.c_str()); return true; }
void DEBUG_WRI_STRUCT (wri_struct *w, int spaces) { #ifdef DEBUG char sp[16], format[48], x[8]; sprintf(sp, "%%-%d.%ds", spaces, spaces); for (int i = 0; w[i].name; i++) { switch (w[i].type) { case CT_VALUE: sprintf(x, "%%0%dX", w[i].size << 1); sprintf(format, "%s%%-13.13s= 0x%s (%%d)\n", sp, x); UT_DEBUGMSG((format, " ", w[i].name, w[i].value, w[i].value)); break; case CT_BLOB: sprintf(format, "%s%%-13.13s: tblob (%%d)\n", sp); UT_DEBUGMSG((format, " ", w[i].name, w[i].size)); break; case CT_IGNORE: sprintf(format, "%s%%-13.13s ignored\n", sp); UT_DEBUGMSG((format, " ", w[i].name)); break; } } #else UT_UNUSED(w); UT_UNUSED(spaces); #endif }
void AccountHandler::_reportProtocolError(UT_sint32 remoteVersion, UT_sint32 errorEnum, BuddyPtr pBuddy) { #ifndef DEBUG UT_UNUSED(remoteVersion); UT_UNUSED(errorEnum); #endif UT_DEBUGMSG(("_reportProtocolError: remoteVersion=%d errorEnum=%d\n", remoteVersion, errorEnum)); UT_return_if_fail(pBuddy); static std::set<std::string> reportedBuddies; if (reportedBuddies.insert( pBuddy->getDescriptor(false).utf8_str() ).second) { UT_UTF8String msg; switch (errorEnum) { case PE_Invalid_Version: msg = UT_UTF8String_sprintf("Your buddy %s is using version %d of AbiCollab, while you are using version %d.\n" "Please make sure you are using the same AbiWord version.", pBuddy->getDescription().utf8_str(), remoteVersion, ABICOLLAB_PROTOCOL_VERSION); break; default: msg = UT_UTF8String_sprintf("An unknown error code %d was reported by buddy %s.", errorEnum, pBuddy->getDescription().utf8_str()); break; } XAP_App::getApp()->getLastFocussedFrame()->showMessageBox( msg.utf8_str(), XAP_Dialog_MessageBox::b_O, XAP_Dialog_MessageBox::a_OK); } }
static gboolean s_focus_out(GtkWidget *widget, GdkEvent *event, gpointer user_data) { UT_UNUSED(event); UT_UNUSED(user_data); gtk_editable_select_region(GTK_EDITABLE(widget), 0, 0); return FALSE; }
bool GR_VectorImage::render(GR_Graphics* pGR, UT_sint32 xDest, UT_sint32 yDest) { UT_UNUSED(pGR); UT_UNUSED(xDest); UT_UNUSED(yDest); UT_ASSERT_NOT_REACHED(); return false; }
ABI_BUILTIN_FAR_CALL int abi_plugin_supports_version (UT_uint32 major, UT_uint32 minor, UT_uint32 release) { UT_UNUSED(major); UT_UNUSED(minor); UT_UNUSED(release); return 1; }
UT_Error IE_Imp_OpenDocument::_loadRDFFromFile ( GsfInput* pInput, const char * pStream, RDFArguments* args ) { UT_return_val_if_fail(pInput, UT_ERROR); #ifndef WITH_REDLAND UT_UNUSED(pStream); UT_UNUSED(args); return UT_OK; #else int sz = gsf_input_size (pInput); if (sz > 0) { // I would have liked to pass 0 to input_read() and // get a shared buffer back, but doing so seems to // return a non-null terminated buffer, so we make a // smart_ptr to an array an explicitly nul-terminate it. boost::shared_array<char> data( new char[sz+1] ); data[sz] = '\0'; gsf_input_read ( pInput, sz, (guint8*)data.get() ); if( sz && !data ) { return UT_ERROR; } // Note that although the API docs say you can use NULL for base_uri // you will likely find it an error to try to call that way. librdf_uri* base_uri = librdf_new_uri( args->world, (const unsigned char*)pStream ); if( !base_uri ) { UT_DEBUGMSG(("Failed to create a base URI to parse RDF into model. stream:%s sz:%d\n", pStream, sz )); return UT_ERROR; } UT_DEBUGMSG(("_handleRDFStreams() stream:%s RDF/XML:::%s:::\n", pStream, data.get() )); if( librdf_parser_parse_string_into_model( args->parser, (const unsigned char*)data.get(), base_uri, args->model )) { UT_DEBUGMSG(("Failed to parse RDF into model. stream:%s sz:%d\n", pStream, sz )); librdf_free_uri( base_uri ); return UT_ERROR; } librdf_free_uri( base_uri ); } return UT_OK; #endif }
static gboolean s_modifyPreview_draw(GtkWidget * widget, gpointer /* data */, AP_UnixDialog_Styles * me) { UT_UNUSED(widget); UT_ASSERT(widget && me); me->event_ModifyPreviewExposed(); return FALSE; }
void XAP_Draw_Symbol::draw(const UT_Rect *clip) { UT_UNUSED(clip); UT_ASSERT(m_gc); UT_uint32 wwidth, wheight, /*yoff, xoff,*/ x, y; UT_sint32 i; GR_Painter painter(m_gc); wwidth = m_drawWidth; wheight = m_drawHeight; UT_uint32 tmpw = wwidth / 32; UT_uint32 tmph = wheight / 7; // yoff = wheight / (2 * 7); // xoff = wwidth / (2 * 32); painter.clearArea(0, 0, wwidth, wheight); int pos = 0; for (i = m_start_base; i < m_vCharSet.size(); i += 2) { UT_UCSChar base = static_cast<UT_UCSChar>(m_vCharSet[i]); UT_sint32 nb_chars = m_vCharSet[i + 1]; for (UT_UCSChar j = base + (m_start_base == i? m_start_nb_char: 0); j < base + nb_chars; ++j) { UT_sint32 w = m_gc->measureUnRemappedChar(j); if(w != GR_CW_ABSENT) { x = (pos % 32) * tmpw + (tmpw - w) / 2; y = pos / 32 * tmph; painter.drawChars(&j, 0, 1, x, y); } ++pos; if(pos > 32 * 7) break; } if(pos > 32 * 7) break; } y = 0; for(i = 0; i <= 7; i++) { painter.drawLine(0, y, wwidth - m_areagc->tlu(1), y); y += tmph; } x = 0; for(i = 0; i <= 32; i++) { painter.drawLine(x, 0, x, wheight - m_areagc->tlu(1)); x += tmpw; } }
/** * Convert the RDF contained in pDoc->getDocumenrRDF() to RDF/XML and * store that in manifest.rdf updating the pDoc so that a manifest * entry is created in META_INF by the manifest writing code. */ bool ODe_RDFWriter::writeRDF( PD_Document* pDoc, GsfOutfile* pODT, PD_RDFModelHandle additionalRDF ) { #ifndef WITH_REDLAND UT_UNUSED(pDoc); UT_UNUSED(pODT); UT_UNUSED(additionalRDF); return true; #else UT_DEBUGMSG(("writeRDF() \n")); GsfOutput* oss = gsf_outfile_new_child(GSF_OUTFILE(pODT), "manifest.rdf", FALSE); // // Convert the native RDF model into a redland one // PD_DocumentRDFHandle rdf = pDoc->getDocumentRDF(); std::list< PD_RDFModelHandle > ml; ml.push_back( rdf ); ml.push_back( additionalRDF ); std::string rdfxml = toRDFXML( ml ); ODe_gsf_output_write (oss, rdfxml.size(), (const guint8*)rdfxml.data() ); ODe_gsf_output_close(oss); // // add an entry that the manifest writing code will pick up // { UT_ByteBufPtr pByteBuf(new UT_ByteBuf); std::string mime_type = "application/rdf+xml"; PD_DataItemHandle* ppHandle = NULL; if(!pDoc->createDataItem("manifest.rdf", 0, pByteBuf, mime_type, ppHandle)) { UT_DEBUGMSG(("writeRDF() setting up manifest entry failed!\n")); } // This is to test to new dnode manifest code. // pDoc->createDataItem( "some/many/directories/foo.xml", 0, &pByteBuf, // mime_type, ppHandle ); } UT_DEBUGMSG(("writeRDF() complete\n")); return true; #endif }
static void s_styletype(GtkWidget * widget, AP_UnixDialog_Styles * me) { UT_UNUSED(widget); UT_ASSERT(widget && me); if(me->isModifySignalBlocked()) return; me->event_styleType(); }
static int explicit_wmf_error (const char* str, wmf_error_t err) { UT_UNUSED(str); switch (err) { case wmf_E_None: return 0; default: return 1; } }
void AP_Preview_Annotation::draw(const UT_Rect *clip) { UT_UNUSED(clip); m_drawString = m_sDescription; UT_RGBColor FGcolor(0,0,0); UT_RGBColor BGcolor(m_clrBackground); m_pFont = m_gc->findFont("Times New Roman", "normal", "normal", "normal", "normal", "12pt", NULL); UT_ASSERT_HARMLESS(m_pFont); if(!m_pFont) { clearScreen(); return; } m_gc->setFont(m_pFont); m_iAscent = m_gc->getFontAscent(m_pFont); m_iDescent = m_gc->getFontDescent(m_pFont); m_iHeight = m_gc->getFontHeight(m_pFont); clearScreen(); // // Calculate the draw coordinates position // UT_sint32 iTop = m_gc->tlu(1); UT_sint32 len = m_drawString.size(); UT_sint32 iLeft = m_gc->tlu(2); // // Fill the background color // GR_Painter painter(m_gc); // // Do the draw chars at last! // m_gc->setColor(FGcolor); painter.drawChars(m_drawString.ucs4_str(), 0, len, iLeft, iTop); // bad hardcoded color, but this will probably [ <-this assumption is the bad thing :) ] never be different anyway m_gc->setColor(UT_RGBColor(0,0,0)); painter.drawLine(0, 0, m_gc->tlu(getWindowWidth()), 0); painter.drawLine(m_gc->tlu(getWindowWidth()) - m_gc->tlu(1), 0, m_gc->tlu(getWindowWidth()) - m_gc->tlu(1), m_gc->tlu(getWindowHeight())); painter.drawLine(m_gc->tlu(getWindowWidth()) - m_gc->tlu(1), m_gc->tlu(getWindowHeight()) - m_gc->tlu(1), 0, m_gc->tlu(getWindowHeight()) - m_gc->tlu(1)); painter.drawLine(0, m_gc->tlu(getWindowHeight()) - m_gc->tlu(1), 0, 0); }
static void sAddHelpButton (GtkDialog * me, XAP_Dialog * pDlg) { #if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON UT_UNUSED(me); UT_UNUSED(pDlg); #else // prevent help button from being added twice gint has_button = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (me), "has-help-button")); if (has_button) return; if (pDlg && pDlg->getHelpUrl().size () > 0) { #ifdef HAVE_SDI GtkWidget * image = gtk_image_new_from_stock(GTK_STOCK_HELP, GTK_ICON_SIZE_BUTTON); GtkWidget * button = gtk_button_new(); gtk_container_add(GTK_CONTAINER(button), image); GtkWidget * alignment = gtk_alignment_new (0, 0.5, 0, 0); gtk_container_add (GTK_CONTAINER(alignment), button); #else GtkWidget * alignment = gtk_button_new_from_stock (GTK_STOCK_HELP); GtkWidget * button = alignment; #endif gtk_box_pack_start(GTK_BOX(me->action_area), alignment, FALSE, FALSE, 0); gtk_button_box_set_child_secondary (GTK_BUTTON_BOX(me->action_area), alignment, TRUE); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK(help_button_cb), pDlg); gtk_widget_show_all (alignment); g_object_set_data (G_OBJECT (me), "has-help-button", GINT_TO_POINTER (1)); } #endif }
void XAP_UnixDialog_Print::releasePrinterGraphicsContext(GR_Graphics * pGraphics) { UT_UNUSED(pGraphics); UT_ASSERT(pGraphics == m_pPrintGraphics); DELETEP(m_pPrintGraphics); if(m_pPageSetup) g_object_unref(m_pPageSetup); m_pPageSetup = NULL; if(m_pGtkPageSize) gtk_paper_size_free (m_pGtkPageSize); m_pGtkPageSize= NULL; if(m_pPO) g_object_unref(m_pPO); m_pPO= NULL; }
/*! * Stop this idle from running */ void UT_UnixIdle::stop () { // // Sevior: Once again we have to ignore this if the idle is already stopped. // UT_ASSERT(m_id > 0); if(m_id > 0) { #ifndef TOOLKIT_COCOA gboolean b = g_idle_remove_by_data(this); UT_UNUSED(b); UT_ASSERT(TRUE == b); #else UT_ASSERT (UT_NOT_IMPLEMENTED); #endif } m_id = -1; }
void AP_Preview_PageNumbers::draw (const UT_Rect *clip) { UT_UNUSED(clip); GR_Painter painter(m_gc); int x = 0, y = 0; UT_sint32 iWidth = m_gc->tlu (getWindowWidth()); UT_sint32 iHeight = m_gc->tlu (getWindowHeight()); UT_Rect pageRect(m_gc->tlu(7), m_gc->tlu(7), iWidth - m_gc->tlu(14), iHeight - m_gc->tlu(14)); painter.fillRect(GR_Graphics::CLR3D_Background, 0, 0, iWidth, iHeight); painter.clearArea(pageRect.left, pageRect.top, pageRect.width, pageRect.height); // actually draw some "text" on the preview for a more realistic appearance m_gc->setLineWidth(m_gc->tlu(1)); m_gc->setColor3D(GR_Graphics::CLR3D_Foreground); UT_sint32 iFontHeight = m_gc->getFontHeight (); UT_sint32 step = m_gc->tlu(4); for (int txty = pageRect.top + (2 * iFontHeight); txty < pageRect.top + pageRect.height - (2 * iFontHeight); txty += step) { painter.drawLine (pageRect.left + m_gc->tlu(5), txty, pageRect.left + pageRect.width - m_gc->tlu(5), txty); } // draw in the page number as a header or footer, properly aligned switch (m_align) { case AP_Dialog_PageNumbers::id_RALIGN : x = pageRect.left + pageRect.width - (2 * m_gc->measureUnRemappedChar(*m_str)); break; case AP_Dialog_PageNumbers::id_CALIGN : x = pageRect.left + (int)(pageRect.width / 2); break; case AP_Dialog_PageNumbers::id_LALIGN : x = pageRect.left + m_gc->measureUnRemappedChar(*m_str); break; } switch (m_control) { case AP_Dialog_PageNumbers::id_HDR : y = pageRect.top + (int)(iFontHeight / 2); break; case AP_Dialog_PageNumbers::id_FTR : y = pageRect.top + pageRect.height - (int)(1.5 * iFontHeight); break; } //m_gc->setColor3D(GR_Graphics::CLR3D_Foreground); painter.drawChars (m_str, 0, UT_UCS4_strlen(m_str), x, y); }
bool ap_ViewListener::notify(AV_View * pView, const AV_ChangeMask mask) { UT_UNUSED(pView); UT_ASSERT(pView); UT_ASSERT(pView==m_pFrame->getCurrentView()); if ((mask & AV_CHG_DIRTY) || (mask & AV_CHG_FILENAME)) { // NOTE: could pass mask here to make updateTitle more efficient m_pFrame->updateTitle(); } if(mask & AV_CHG_INPUTMODE) { m_pFrame->getMouse()->setEditEventMap(XAP_App::getApp()->getEditEventMapper()); m_pFrame->getKeyboard()->setEditEventMap(XAP_App::getApp()->getEditEventMapper()); } return true; }
bool IE_Imp_RDF::pasteFromBuffer( PD_DocumentRange * pDocRange, const unsigned char * pData, UT_uint32 lenData, const char *szEncoding ) { UT_UNUSED(szEncoding); UT_return_val_if_fail(getDoc() == pDocRange->m_pDoc,false); UT_return_val_if_fail(pDocRange->m_pos1 == pDocRange->m_pos2,false); std::stringstream ss; ss.write( (const char*)pData, lenData ); UT_DEBUGMSG(("IE_Imp_RDF::pasteFromBuffer() have data:%s\n", ss.str().c_str() )); setClipboard (pDocRange->m_pos1); bool ret = pasteFromBufferSS( pDocRange, ss, szEncoding ); return ret; }
/*! This is a debugging tool which serves to dump in readable form (as UT_DEBUGMSGs) the contents of [this] AP. */ void PP_AttrProp::miniDump(const PD_Document * pDoc) const { #ifdef DEBUG const gchar * pName, * pValue; UT_uint32 i = 0; UT_DEBUGMSG(("--------------------- PP_AttrProp mini dump --------------------------------\n")); UT_DEBUGMSG(("Attributes:\n")); while(getNthAttribute(i,pName,pValue)) { UT_DEBUGMSG(("%s : %s\n", pName, pValue)); ++i; } UT_DEBUGMSG(("Properties:\n")); i = 0; while(getNthProperty(i,pName,pValue)) { UT_DEBUGMSG(("%s : %s\n", pName, pValue)); ++i; } if(m_iRevisedIndex != 0xffffffff && pDoc) { UT_DEBUGMSG(("Attached revised AP:\n")); const PP_AttrProp * pRevAP; pDoc->getAttrProp(m_iRevisedIndex, const_cast<const PP_AttrProp **>(&pRevAP)); // avoid endless loop on circular reference if(pRevAP && pRevAP->getRevisedIndex() != m_iRevisedIndex) pRevAP->miniDump(pDoc); } UT_DEBUGMSG(("----------------------------------------------------------------------------\n")); #else UT_UNUSED(pDoc); #endif }
// // AbiPaint editImage // ------------------ // This is the function that we actually call to invoke the image editor. // // parameters are: // AV_View* v // EV_EditMethodCallData *d // static DECLARE_ABI_PLUGIN_METHOD(editImage) { UT_UNUSED(v); // Get the current view that the user is in. XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame(); FV_View* pView = static_cast<FV_View*>(pFrame->getCurrentView()); // // get values from preference (initial plugin execution should have set sensible defaults) // UT_String imageApp; // holds MAXPATH\appName <space> MAXPATH\imagefilename bool bLeaveImageAsPNG; // read stuff from the preference value if (!prefsScheme->getValue(ABIPAINT_PREF_KEY_szProgramName, imageApp)) { UT_ASSERT(UT_SHOULD_NOT_HAPPEN); getDefaultApp(imageApp, bLeaveImageAsPNG); } // now that we have program name, try to get other flag (allows overriding default value) // Note: we allow overriding, otherwise if we don't adhere to user's setting // then the use BMP or not menu should be greyed to note it has no effect prefsScheme->getValueBool(ABIPAINT_PREF_KEY_bLeaveImageAsPNG, &bLeaveImageAsPNG); // // generate a temp file name... // char *szTempFileName = NULL; GError *err = NULL; gint fp = g_file_open_tmp ("XXXXXX", &szTempFileName, &err); if (err) { g_warning ("%s", err->message); g_error_free (err); err = NULL; return FALSE; } close(fp); UT_String szTmpPng = szTempFileName; szTmpPng += ".png"; UT_String szTmp = szTmpPng; // default: our temp file is the created png file PT_DocPosition pos = pView->saveSelectedImage((const char *)szTmpPng.c_str()); if(pos == 0) { remove(szTempFileName); g_free (szTempFileName); szTempFileName = NULL; pFrame->showMessageBox("You must select an Image before editing it", XAP_Dialog_MessageBox::b_O,XAP_Dialog_MessageBox::a_OK); return false; } #ifdef ENABLE_BMP // // Convert png into bmp for best compatibility with Windows programs // NOTE: probably looses detail/information though!!! so if possible use PNG // if (!bLeaveImageAsPNG) { szTmp = szTempFileName; szTmp += ".bmp"; // our temp file is a bmp file if (convertPNG2BMP(szTmpPng.c_str(), szTmp.c_str())) { pFrame->showMessageBox("Unable to convert PNG image data to BMP for external program use!", XAP_Dialog_MessageBox::b_O,XAP_Dialog_MessageBox::a_OK); UT_ASSERT(UT_SHOULD_NOT_HAPPEN); remove(szTempFileName); g_free (szTempFileName); szTempFileName = NULL; remove(szTmpPng.c_str()); return false; } // remove(szTmpPng.c_str()); } #endif // remove the temp file (that lacks proper extension) remove(szTempFileName); g_free (szTempFileName); szTempFileName = NULL; // // Get the initial file status. // struct stat myFileStat; int ok = stat(szTmp.c_str(),&myFileStat); if(ok < 0) { UT_ASSERT(UT_SHOULD_NOT_HAPPEN); remove(szTmpPng.c_str()); remove(szTmp.c_str()); // should silently fail if exporting as PNG file return false; } time_t mod_time = myFileStat.st_mtime; // // Fire up the image editor... // ProcessInfo procInfo; if (!createChildProcess(imageApp.c_str(), szTmp.c_str(), &procInfo)) { UT_String msg = "Unable to run program: "; msg += imageApp + " " + szTmp; pFrame->showMessageBox(msg.c_str(), XAP_Dialog_MessageBox::b_O,XAP_Dialog_MessageBox::a_OK); // failed to spawn stuff, so do some cleanup and return failure remove(szTmpPng.c_str()); remove(szTmp.c_str()); // should silently fail if exporting as PNG file return false; } lockGUI(d); while (isProcessStillAlive(procInfo)) { UT_usleep(10000); // wait 10 milliseconds pFrame->nullUpdate(); ok = stat(szTmp.c_str(),&myFileStat); if(ok == 0) { if(myFileStat.st_mtime != mod_time) { // wait for changes to settle (program done writing changes) // we use both modified time & file size, but really we // could just use file size as mod time doesn't appear to change for small images mod_time = myFileStat.st_mtime; off_t size = myFileStat.st_size; UT_usleep(100000); // wait 100 milliseconds (so program may have time to write something) ok = stat(szTmp.c_str(),&myFileStat); while((mod_time != myFileStat.st_mtime) || !size || (size > 0 && size != myFileStat.st_size)) { mod_time = myFileStat.st_mtime; size = myFileStat.st_size; ok = stat(szTmp.c_str(),&myFileStat); UT_usleep(500000); // wait a while, let program write its data // just make sure the program is still running, otherwise we could get stuck in a loop if (!isProcessStillAlive(procInfo)) { pFrame->showMessageBox("External image editor appears to have been terminated unexpectedly.", XAP_Dialog_MessageBox::b_O,XAP_Dialog_MessageBox::a_OK); //procInfo.hProcess = 0; goto Cleanup; } } mod_time = myFileStat.st_mtime; UT_usleep(100000); // wait a while just to make sure program is done with file // // OK replace the current image with this. // IEGraphicFileType iegft = IEGFT_Unknown; FG_Graphic* pFG; UT_Error errorCode; #ifdef ENABLE_BMP // // Convert bmp back to png (as we can not assume AbiWord has builtin BMP support [as its now an optional plugin]) // NOTE: probably looses detail/information though!!! so if possible use only PNG // if (!bLeaveImageAsPNG) { if (convertBMP2PNG(szTmp.c_str(), szTmpPng.c_str())) { pFrame->showMessageBox("Unable to convert BMP image data back to PNG for AbiWord to import!", XAP_Dialog_MessageBox::b_O,XAP_Dialog_MessageBox::a_OK); UT_ASSERT(UT_SHOULD_NOT_HAPPEN); goto Cleanup; } } #endif errorCode = IE_ImpGraphic::loadGraphic(szTmpPng.c_str(), iegft, &pFG); if(errorCode) { UT_ASSERT(UT_SHOULD_NOT_HAPPEN); pFrame->showMessageBox("Error making pFG. Could not put image back into Abiword", XAP_Dialog_MessageBox::b_O,XAP_Dialog_MessageBox::a_OK); goto Cleanup; } unlockGUI(d); pView->cmdUnselectSelection(); pView->setPoint(pos); pView->extSelHorizontal(true, 1); // move point forward one errorCode = pView->cmdInsertGraphic(pFG); if (errorCode) { pFrame->showMessageBox("Could not put image back into Abiword", XAP_Dialog_MessageBox::b_O,XAP_Dialog_MessageBox::a_OK); UT_ASSERT(UT_SHOULD_NOT_HAPPEN); DELETEP(pFG); goto Cleanup; } DELETEP(pFG); // // Reselect the image // pView->setPoint(pos); pView->extSelHorizontal(true, 1); // move point forward one lockGUI(d); } } } // // Normal exit, delete the tempfile and return success // remove(szTmpPng.c_str()); remove(szTmp.c_str()); // should silently fail if exporting as PNG file unlockGUI(d); return true; // // Something went wrong. // Cleanup: remove(szTmpPng.c_str()); remove(szTmp.c_str()); // should silently fail if exporting as PNG file unlockGUI(d); // // Kill the image editor. // endProcess(procInfo); return false; }
static void s_style_name(GtkWidget * widget, AP_UnixDialog_Styles * me) { UT_UNUSED(widget); UT_ASSERT(widget && me); me->new_styleName(); }
/* * * Finally draw the characters in the preview. * */ void XAP_Preview_FontPreview::draw(const UT_Rect *clip) { UT_UNUSED(clip); // // Get text decorations. // bool isUnder,isOver,isStrike; const std::string sDecor = getVal("text-decoration"); if(!sDecor.empty()) { isUnder = (NULL != strstr(sDecor.c_str(),"underline")); isOver = (NULL != strstr(sDecor.c_str(),"overline")); isStrike = (NULL != strstr(sDecor.c_str(),"line-through")); } else { isUnder = false; isOver = false; isStrike = false; } // // Do foreground and background colors. // UT_RGBColor FGcolor(0,0,0); const std::string sFGColor = getVal("color"); if(!sFGColor.empty()) UT_parseColor(sFGColor.c_str(),FGcolor); UT_RGBColor BGcolor(m_clrBackground); const std::string sBGColor = getVal("bgcolor"); if(!sBGColor.empty() && strcmp(sBGColor.c_str(),"transparent") != 0) UT_parseColor(sBGColor.c_str(),BGcolor); // // Get the font and bold/italic- ness // //GR_Font * pFont; std::string sFamily = getVal("font-family"); std::string sStyle = getVal("font-style"); std::string sVariant = getVal("font-variant"); std::string sStretch = getVal("font-stretch"); std::string sSize = getVal("font-size"); std::string sWeight = getVal("font-weight"); if(sFamily.empty()) sFamily = "Times New Roman"; if(sStyle.empty()) sStyle = "normal"; if(sVariant.empty()) sVariant = "normal"; if(sStretch.empty()) sStretch = "normal"; if(sSize.empty()) sSize="12pt"; if(sWeight.empty()) sWeight = "normal"; m_pFont = m_gc->findFont(sFamily.c_str(), sStyle.c_str(), sVariant.c_str(), sWeight.c_str(), sStretch.c_str(), sSize.c_str(), NULL); UT_ASSERT_HARMLESS(m_pFont); if(!m_pFont) { clearScreen(); return; } m_gc->setFont(m_pFont); m_iAscent = m_gc->getFontAscent(m_pFont); m_iDescent = m_gc->getFontDescent(m_pFont); m_iHeight = m_gc->getFontHeight(m_pFont); // // Clear the screen! // clearScreen(); // // Calculate the draw coordinates position // UT_sint32 iWinWidth = m_gc->tlu(getWindowWidth()); UT_sint32 iWinHeight = m_gc->tlu(getWindowHeight()); UT_sint32 iTop = (iWinHeight - m_iHeight)/2; UT_sint32 len = UT_UCS4_strlen(m_pszChars); UT_sint32 twidth = m_gc->measureString(m_pszChars,0,len,NULL); UT_sint32 iLeft = (iWinWidth - twidth)/2; // // Fill the background color // GR_Painter painter(m_gc); if(!sBGColor.empty()) painter.fillRect(BGcolor,iLeft,iTop,twidth,m_iHeight); // // Do the draw chars at last! // m_gc->setColor(FGcolor); painter.drawChars(m_pszChars, 0, len, iLeft, iTop); // // Do the decorations // if(isUnder) { UT_sint32 iDrop = iTop + m_iAscent + m_iDescent/3; painter.drawLine(iLeft,iDrop,iLeft+twidth,iDrop); } if(isOver) { UT_sint32 iDrop = iTop + m_gc->tlu(1) + (UT_MAX(m_gc->tlu(10),m_iAscent) - m_gc->tlu(10))/8; painter.drawLine(iLeft,iDrop,iLeft+twidth,iDrop); } if(isStrike) { UT_sint32 iDrop = iTop + m_iAscent * 2 /3; painter.drawLine(iLeft,iDrop,iLeft+twidth,iDrop); } // bad hardcoded color, but this will probably [ <-this assumption is the bad thing :) ] never be different anyway m_gc->setColor(UT_RGBColor(0,0,0)); painter.drawLine(0, 0, m_gc->tlu(getWindowWidth()), 0); painter.drawLine(m_gc->tlu(getWindowWidth()) - m_gc->tlu(1), 0, m_gc->tlu(getWindowWidth()) - m_gc->tlu(1), m_gc->tlu(getWindowHeight())); painter.drawLine(m_gc->tlu(getWindowWidth()) - m_gc->tlu(1), m_gc->tlu(getWindowHeight()) - m_gc->tlu(1), 0, m_gc->tlu(getWindowHeight()) - m_gc->tlu(1)); painter.drawLine(0, m_gc->tlu(getWindowHeight()) - m_gc->tlu(1), 0, 0); }
void AP_FormatTable_preview::draw(const UT_Rect *clip) { UT_UNUSED(clip); GR_Painter painter(m_gc); UT_sint32 iWidth = m_gc->tlu (getWindowWidth()); UT_sint32 iHeight = m_gc->tlu (getWindowHeight()); UT_Rect pageRect(m_gc->tlu(7), m_gc->tlu(7), iWidth - m_gc->tlu(14), iHeight - m_gc->tlu(14)); painter.fillRect(GR_Graphics::CLR3D_Background, 0, 0, iWidth, iHeight); painter.clearArea(pageRect.left, pageRect.top, pageRect.width, pageRect.height); UT_RGBColor tmpCol; UT_RGBColor black(0, 0, 0); m_gc->setLineWidth(m_gc->tlu(1)); int border = m_gc->tlu(20); int cornerLength = m_gc->tlu(5); // // Draw the cell background // const gchar * pszBGCol = NULL; if(m_pFormatTable->getImage()) { GR_Image * pImg = m_pFormatTable->getImage(); FG_Graphic * pFG = m_pFormatTable->getGraphic(); const char * szName = pFG->getDataId(); const UT_ByteBuf * pBB = pFG->getBuffer(); if(pFG->getType() == FGT_Raster) { pImg = static_cast<GR_Image *>( m_gc->createNewImage( szName, pBB, pFG->getMimeType(), pageRect.width - 2*border, pageRect.height - 2*border, GR_Image::GRT_Raster)); } else { pImg = static_cast<GR_Image *>( m_gc->createNewImage( szName, pBB, pFG->getMimeType(), pageRect.width - 2*border, pageRect.height - 2*border, GR_Image::GRT_Vector)); } UT_Rect rec(pageRect.left + border, pageRect.top + border, pageRect.width - 2*border, pageRect.height - 2*border); painter.drawImage(pImg,pageRect.left + border, pageRect.top + border); delete pImg; } else { m_pFormatTable->getPropVector().getProp(static_cast<const gchar *>("background-color"), pszBGCol); if (pszBGCol && *pszBGCol) { UT_parseColor(pszBGCol, tmpCol); painter.fillRect(tmpCol, pageRect.left + border, pageRect.top + border, pageRect.width - 2*border, pageRect.height - 2*border); } } // // Draw the cell corners // m_gc->setColor(UT_RGBColor(127,127,127)); // top left corner painter.drawLine(pageRect.left + border - cornerLength, pageRect.top + border, pageRect.left + border, pageRect.top + border); painter.drawLine(pageRect.left + border, pageRect.top + border - cornerLength, pageRect.left + border, pageRect.top + border); // top right corner painter.drawLine(pageRect.left + pageRect.width - border + cornerLength, pageRect.top + border, pageRect.left + pageRect.width - border, pageRect.top + border); painter.drawLine(pageRect.left + pageRect.width - border, pageRect.top + border - cornerLength, pageRect.left + pageRect.width - border, pageRect.top + border); // bottom left corner painter.drawLine(pageRect.left + border - cornerLength, pageRect.top + pageRect.height - border, pageRect.left + border, pageRect.top + pageRect.height - border); painter.drawLine(pageRect.left + border, pageRect.top + pageRect.height - border + cornerLength, pageRect.left + border, pageRect.top + pageRect.height - border); // bottom right corner painter.drawLine(pageRect.left + pageRect.width - border + cornerLength, pageRect.top + pageRect.height - border, pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border); painter.drawLine(pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border + cornerLength, pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border); // // Draw the cell borders // // top border if (m_pFormatTable->getTopToggled()) { const gchar * pszTopColor = NULL; m_pFormatTable->getPropVector().getProp("top-color", pszTopColor); if (pszTopColor) { UT_parseColor(pszTopColor, tmpCol); m_gc->setColor(tmpCol); } else m_gc->setColor(black); const gchar * pszTopThickness = NULL; m_pFormatTable->getPropVector().getProp("top-thickness", pszTopThickness); if(pszTopThickness) { UT_sint32 iTopThickness = UT_convertToLogicalUnits(pszTopThickness); m_gc->setLineWidth(iTopThickness); } else { m_gc->setLineWidth(m_gc->tlu(1)); } painter.drawLine(pageRect.left + border, pageRect.top + border, pageRect.left + pageRect.width - border, pageRect.top + border); } // left border if (m_pFormatTable->getLeftToggled()) { const gchar * pszLeftColor = NULL; m_pFormatTable->getPropVector().getProp("left-color", pszLeftColor); if (pszLeftColor) { UT_parseColor(pszLeftColor, tmpCol); m_gc->setColor(tmpCol); } else m_gc->setColor(black); const gchar * pszLeftThickness = NULL; m_pFormatTable->getPropVector().getProp("left-thickness", pszLeftThickness); if(pszLeftThickness) { UT_sint32 iLeftThickness = UT_convertToLogicalUnits(pszLeftThickness); m_gc->setLineWidth(iLeftThickness); } else { m_gc->setLineWidth(m_gc->tlu(1)); } painter.drawLine(pageRect.left + border, pageRect.top + border, pageRect.left + border, pageRect.top + pageRect.height - border); } // right border if (m_pFormatTable->getRightToggled()) { const gchar * pszRightColor = NULL; m_pFormatTable->getPropVector().getProp("right-color", pszRightColor); if (pszRightColor) { UT_parseColor(pszRightColor, tmpCol); m_gc->setColor(tmpCol); } else m_gc->setColor(black); const gchar * pszRightThickness = NULL; m_pFormatTable->getPropVector().getProp("right-thickness", pszRightThickness); if(pszRightThickness) { UT_sint32 iRightThickness = UT_convertToLogicalUnits(pszRightThickness); m_gc->setLineWidth(iRightThickness); } else { m_gc->setLineWidth(m_gc->tlu(1)); } painter.drawLine(pageRect.left + pageRect.width - border, pageRect.top + border, pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border); } // bottom border if (m_pFormatTable->getBottomToggled()) { const gchar * pszBottomColor = NULL; m_pFormatTable->getPropVector().getProp("bot-color", pszBottomColor); if (pszBottomColor) { UT_parseColor(pszBottomColor, tmpCol); m_gc->setColor(tmpCol); } else m_gc->setColor(black); const gchar * pszBotThickness = NULL; m_pFormatTable->getPropVector().getProp("bot-thickness", pszBotThickness); if(pszBotThickness) { UT_sint32 iBotThickness = UT_convertToLogicalUnits(pszBotThickness); m_gc->setLineWidth(iBotThickness); } else { m_gc->setLineWidth(m_gc->tlu(1)); } painter.drawLine(pageRect.left + border, pageRect.top + pageRect.height - border, pageRect.left + pageRect.width - border, pageRect.top + pageRect.height - border); } }
bool pt_PieceTable::_realInsertStrux(PT_DocPosition dpos, PTStruxType pts, const gchar ** attributes, const gchar ** properties, pf_Frag_Strux ** ppfs_ret) { // insert a new structure fragment at the given document position. // this function can only be called while editing the document. // Also can specify an indexAP to be used for the frag rather // than that obtained by default. Very useful for insertting // Cells where you can immediately specify the cell position in // a table. this function can only be called while editing the // document. UT_return_val_if_fail (m_pts==PTS_Editing, false); // get the fragment at the doc postion containing the given // document position. pf_Frag * pf = NULL; PT_BlockOffset fragOffset = 0; bool bFoundFrag = getFragFromPosition(dpos,&pf,&fragOffset); UT_return_val_if_fail (bFoundFrag, false); // get the strux containing the given position. pf_Frag_Strux * pfsContainer = NULL; bool bFoundContainer = _getStruxFromPosition(dpos,&pfsContainer); UT_return_val_if_fail (bFoundContainer,false); // // Can only insert an endTOC into a TOC // if((pfsContainer->getStruxType() == PTX_SectionTOC) && (pts != PTX_EndTOC)) { bFoundContainer = _getStruxFromPosition(pfsContainer->getPos(),&pfsContainer); dpos--; } if(isEndFootnote(pfsContainer)) { bFoundContainer = _getStruxFromFragSkip(pfsContainer,&pfsContainer); } // if we are inserting something similar to the previous strux, // we will clone the attributes/properties; we assume that the // new strux should have the same AP as the one which preceeds us. // This is generally true for inserting a paragraph -- it should // inherit the style of the one we just broke. PT_AttrPropIndex indexAP = 0; if (pfsContainer->getStruxType() == pts) { // TODO paul, add code here to see if this strux has a "followed-by" // TODO paul, property (or property in the style) and get the a/p // TODO paul, from there rather than just taking the attr/prop // TODO paul, of the previous strux. indexAP = pfsContainer->getIndexAP(); } // // Look to see if we're in the middle of a hyperlink span now. // pf_Frag * pHype = _findPrevHyperlink(pf); if(pHype != NULL && (pts != PTX_SectionFrame) // allow annotations in // hyperlinks && (pts != PTX_SectionAnnotation) && (pts != PTX_EndAnnotation)) // frames are always placed // at the end of blocks // so we don't need this { // // We have an open hyperlink! FIXME later we should allow this by terminating // the hyperlink span just before this strux, then doing the insert strux. // Instead for now we'll just disallow this insertStrux. // // This assert is to remind use to write the code to terminate // the hyperlink. // pf_Frag * pEndHype = _findNextHyperlink(pf); PT_DocPosition posEnd = 0; if(pEndHype) { posEnd = pEndHype->getPos(); } // // OK now insert a new end of hyperlink at pf // insertObject(dpos, PTO_Hyperlink,NULL,NULL); m_fragments.cleanFrags(); dpos++; if(posEnd > 0) { // // Now delete the old endhyperlink. // pf_Frag * pfEnd = NULL; UT_uint32 newOff = 0; posEnd++; // from the insert UT_uint32 offset = 0; _deleteObjectWithNotify(posEnd, static_cast<pf_Frag_Object*>(pEndHype), offset,1,pfsContainer,&pfEnd,&newOff,true); } m_fragments.cleanFrags(); bFoundFrag = getFragFromPosition(dpos,&pf,&fragOffset); UT_return_val_if_fail (bFoundFrag, false); } // // If desired, merge in the specified attributes/properties. This // enables cells to inherit the properties of the block from which // they were inserted. // if (attributes || properties) { PT_AttrPropIndex pAPIold = indexAP; bool bMerged = m_varset.mergeAP(PTC_AddFmt,pAPIold,attributes,properties,&indexAP,getDocument()); UT_UNUSED(bMerged); UT_ASSERT_HARMLESS(bMerged); } pf_Frag_Strux * pfsNew = NULL; if (!_createStrux(pts,indexAP,&pfsNew)) return false; pfsNew->setXID(getXID()); // when inserting paragraphs, we try to remember the current // span formatting active at the insertion point and add a // FmtMark immediately after the block. this way, if the // user keeps typing text, the FmtMark will control it's // attr/prop -- if the user warps away and/or edits elsewhere // and then comes back to this point (the FmtMark may or may // not still be here) new text will either use the FmtMark or // look to the right. bool bNeedGlob = false; PT_AttrPropIndex apFmtMark = 0; if (pfsNew->getStruxType() == PTX_Block) { bNeedGlob = _computeFmtMarkForNewBlock(pfsNew,pf,fragOffset,&apFmtMark); if (bNeedGlob) beginMultiStepGlob(); // if we are leaving an empty block (are stealing all it's content) we should // put a FmtMark in it to remember the active span fmt at the time. // this lets things like hitting two consecutive CR's and then comming // back to the first empty paragraph behave as expected. // fixme sevior here if ((pf->getType()==pf_Frag::PFT_Text) && (fragOffset == 0) && (pf->getPrev()!=NULL) && (pf->getPrev()->getType()==pf_Frag::PFT_Strux)) { pf_Frag_Strux *pfsStrux = static_cast<pf_Frag_Strux *>(pf->getPrev()); if(pfsStrux->getStruxType() == PTX_Block) { _insertFmtMarkAfterBlockWithNotify(pfsContainer,dpos,apFmtMark); } } } // // Look if we're placing an endcell in an empty block. If so, // insert a format mark // if (pfsNew->getStruxType() == PTX_EndCell) { if((pf->getPrev()!=NULL) && (pf->getPrev()->getType()==pf_Frag::PFT_Strux)) { pf_Frag_Strux *pfsStrux = static_cast<pf_Frag_Strux *>(pf->getPrev()); if(pfsStrux->getStruxType() == PTX_Block) { _insertFmtMarkAfterBlockWithNotify(pfsContainer,dpos,apFmtMark); } } } // insert this frag into the fragment list. Update the container strux as needed _insertStrux(pf,fragOffset,pfsNew); if (ppfs_ret) *ppfs_ret = pfsNew; // create a change record to describe the change, add // it to the history, and let our listeners know about it. if(pfsNew->getStruxType() == PTX_SectionFrame) { // Inserting a sectionFrame screws up dos. It goes just before the next // block strux found. dpos = pfsNew->getPrev()->getPos() + pfsNew->getPrev()->getLength(); } PX_ChangeRecord_Strux * pcrs = new PX_ChangeRecord_Strux(PX_ChangeRecord::PXT_InsertStrux, dpos,indexAP,pfsNew->getXID(), pts); UT_return_val_if_fail (pcrs,false); // add record to history. we do not attempt to coalesce these. m_history.addChangeRecord(pcrs); m_pDocument->notifyListeners(pfsContainer,pfsNew,pcrs); if (bNeedGlob) { UT_return_val_if_fail (!pfsNew->getNext() || pfsNew->getNext()->getType()!=pf_Frag::PFT_FmtMark, false); _insertFmtMarkAfterBlockWithNotify(pfsNew,dpos+pfsNew->getLength(),apFmtMark); endMultiStepGlob(); } return true; }
/*! retrieve the 6-byte address of the network card; returns true on success This implementation is from libuuid; it has not been debugged or even compiled */ bool UT_getEthernetAddress(UT_EthernetAddress &a) { UT_UNUSED(a); #if 0 // TODO -- someone should debug this and turn it on #ifdef HAVE_NET_IF_H int sd; struct ifreq ifr, *ifrp; struct ifconf ifc; char buf[1024]; int n, i; unsigned char *a; /* * BSD 4.4 defines the size of an ifreq to be * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len * However, under earlier systems, sa_len isn't present, so the size is * just sizeof(struct ifreq) */ #ifdef HAVE_SA_LEN #define ifreq_size(i) max(sizeof(struct ifreq),\ sizeof((i).ifr_name)+(i).ifr_addr.sa_len) #else #define ifreq_size(i) sizeof(struct ifreq) #endif /* HAVE_SA_LEN*/ sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); if (sd < 0) { return false; } memset(buf, 0, sizeof(buf)); ifc.ifc_len = sizeof(buf); ifc.ifc_buf = buf; if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) { close(sd); return false; } n = ifc.ifc_len; for (i = 0; i < n; i+= ifreq_size(*ifr) ) { ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i); strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ); #ifdef SIOCGIFHWADDR if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0) continue; a = (unsigned char *) &ifr.ifr_hwaddr.sa_data; #else #ifdef SIOCGENADDR if (ioctl(sd, SIOCGENADDR, &ifr) < 0) continue; a = (unsigned char *) ifr.ifr_enaddr; #else /* * XXX we don't have a way of getting the hardware * address */ close(sd); return false; #endif /* SIOCGENADDR */ #endif /* SIOCGIFHWADDR */ if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5]) continue; if (node_id) { memcpy(node_id, a, 6); close(sd); return true; } } close(sd); #endif #else // someone needs to debug/fix, ect., the code above UT_ASSERT(UT_NOT_IMPLEMENTED); #endif return false; }
static void s_remove_property(GtkWidget * widget, AP_UnixDialog_Styles * me) { UT_UNUSED(widget); UT_ASSERT(widget && me); me->event_RemoveProperty(); }
void AP_Preview_Abi::draw(const UT_Rect *clip) { UT_UNUSED(clip); getView()->updateScreen(false); }
bool fl_FrameLayout::doclistener_deleteStrux(const PX_ChangeRecord_Strux * pcrx) { UT_UNUSED(pcrx); UT_ASSERT(pcrx->getType()==PX_ChangeRecord::PXT_DeleteStrux); #if 0 fp_FrameContainer * pFrameC = getFirstContainer(); if(pFrameC && pFrameC->getPage()) { pFrameC->getPage()->markDirtyOverlappingRuns(pFrameC); } #endif fp_FrameContainer * pFrameC = static_cast<fp_FrameContainer *>(getFirstContainer()); UT_GenericVector<fl_BlockLayout *> vecBlocks; pFrameC->getBlocksAroundFrame(vecBlocks); UT_sint32 i = 0; for(i=0; i< vecBlocks.getItemCount();i++) { fl_BlockLayout * pBL = vecBlocks.getNthItem(i); pBL->collapse(); xxx_UT_DEBUGMSG(("Collapse block %x \n",pBL)); } // // Remove all remaining structures // collapse(); // UT_ASSERT(pcrx->getStruxType()== PTX_SectionFrame); // fl_ContainerLayout * pCL = getPrev(); myContainingLayout()->remove(this); UT_DEBUGMSG(("Unlinking frame Layout %p \n",this)); // // Remove from the list of frames in the previous block // while(pCL && pCL->getContainerType() != FL_CONTAINER_BLOCK) { pCL = pCL->getPrev(); } if(pCL == NULL) { UT_DEBUGMSG(("No BlockLayout before this frame! \n")); return false; } fl_BlockLayout * pBL = static_cast<fl_BlockLayout *>(pCL); bool bFound = false; for(i=0; i<pBL->getNumFrames() && !bFound;i++) { fl_FrameLayout * pF = pBL->getNthFrameLayout(i); if(pF == this) { bFound = true; } } if(bFound) { pBL->removeFrame(this); } else { UT_DEBUGMSG(("Whoops! not Frame found. Try ahead \n")); pCL = this; while(pCL && pCL->getContainerType() != FL_CONTAINER_BLOCK) { pCL = pCL->getNext(); } if(pCL == NULL) { UT_DEBUGMSG(("No BlockLayout before this frame! \n")); return false; } pBL = static_cast<fl_BlockLayout *>(pCL); pBL->removeFrame(this); } for(i=0; i< vecBlocks.getItemCount();i++) { pBL = vecBlocks.getNthItem(i); pBL->format(); xxx_UT_DEBUGMSG(("format block %x \n",pBL)); } delete this; // TODO whoa! this construct is VERY dangerous. return true; }