#include <ap_UnixApp.h>
Public Member Functions | |
AP_UnixApp (const char *szAppName) | |
virtual | ~AP_UnixApp () |
virtual bool | initialize (bool has_display) |
virtual XAP_Frame * | newFrame (void) |
virtual bool | forgetFrame (XAP_Frame *pFrame) |
virtual GR_Graphics * | newDefaultScreenGraphics () const |
virtual bool | shutdown (void) |
virtual bool | getPrefsValueDirectory (bool bAppSpecific, const gchar *szKey, const gchar **pszValue) const |
virtual const XAP_StringSet * | getStringSet (void) const |
virtual const char * | getAbiSuiteAppDir (void) const |
virtual const std::string & | getAbiSuiteAppUIDir (void) const |
virtual void | copyToClipboard (PD_DocumentRange *pDocRange, bool bUseClipboard=true) |
virtual void | pasteFromClipboard (PD_DocumentRange *pDocRange, bool bUseClipboard, bool bHonorFormatting=true) |
virtual bool | canPasteFromClipboard (void) |
virtual void | addClipboardFmt (const char *szFormat) |
virtual void | deleteClipboardFmt (const char *szFormat) |
virtual void | setSelectionStatus (AV_View *pView) |
virtual void | setViewSelection (AV_View *pView) |
virtual AV_View * | getViewSelection (void) |
virtual void | clearSelection (void) |
virtual bool | getCurrentSelection (const char **formatList, void **ppData, UT_uint32 *pLen, const char **pszFormatFound) |
virtual void | cacheCurrentSelection (AV_View *) |
void | catchSignals (int sig_num) ABI_NORETURN |
void | loadAllPlugins () |
virtual void | errorMsgBadArg (const char *msg) |
virtual void | errorMsgBadFile (XAP_Frame *pFrame, const char *file, UT_Error error) |
virtual bool | doWindowlessArgs (const AP_Args *, bool &bSuccess) |
bool | makePngPreview (const char *pszInFile, const char *pszPNGFile, UT_sint32 iWidth, UT_sint32 iHeight) |
AP_DiskStringSet * | loadStringsFromDisk (const char *szStringSet, AP_BuiltinStringSet *pFallbackStringSet) |
virtual XAP_UnixClipboard * | getClipboard () |
Static Public Member Functions | |
static int | main (const char *szAppName, int argc, char **argv) |
Protected Attributes | |
XAP_StringSet * | m_pStringSet |
AP_UnixClipboard * | m_pClipboard |
bool | m_bHasSelection |
bool | m_bSelectionInFlux |
bool | m_cacheDeferClear |
AV_View * | m_pViewSelection |
AV_View * | m_cacheSelectionView |
XAP_Frame * | m_pFrameSelection |
UT_ByteBuf | m_selectionByteBuf |
PD_DocumentRange | m_cacheDocumentRangeOfSelection |
AP_UnixApp::AP_UnixApp | ( | const char * | szAppName | ) |
Construct an AP_UnixApp. /param szAppName A string representing the name of the app. Currently always AbiWord (I think).
Referenced by main().
AP_UnixApp::~AP_UnixApp | ( | void | ) | [virtual] |
Destructor for AP_UnixApp's. Cleans up spellcheck, clipboard, and StringSet.
References DELETEP, IE_ImpExp_UnRegisterXP(), m_pClipboard, and m_pStringSet.
virtual void AP_UnixApp::addClipboardFmt | ( | const char * | szFormat | ) | [inline, virtual] |
void AP_UnixApp::cacheCurrentSelection | ( | AV_View * | pView | ) | [virtual] |
bool AP_UnixApp::canPasteFromClipboard | ( | void | ) | [virtual] |
References XAP_UnixClipboard::canPaste(), m_pClipboard, and XAP_UnixClipboard::TAG_ClipboardOnly.
void AP_UnixApp::catchSignals | ( | int | sig_num | ) |
This function actually handles signals. The most commonly recieved one is SIGSEGV, the segfault signal. We want to clean up, save the user's files to backup locations (currently <filename>.saved) and then call abort, so we still get a core dump that we can debug.
sig_num | the integer representing which signal we recieved |
References s_signal_count, AP_App::saveRecoveryFiles(), XAP_App::signalWrapper(), UT_DEBUGMSG, and UT_usleep.
void AP_UnixApp::clearSelection | ( | void | ) | [virtual] |
this method goes with setSelectionStatus().
we are called by the clipboard (thru the callback chain) in response to another application stealing the X Selection.
we need to notify the view so that it can clear the screen as is the custom on X -- only one selection at any time.
we have to watch out here because when we call up to clear the selection, the view will notify the view-listeners of the change, which may cause setSelectionStatus() to get called and thus update the clipboard -- this could recurse a while....
References FV_View::cmdUnselectSelection(), m_bHasSelection, m_bSelectionInFlux, m_pFrameSelection, and m_pViewSelection.
void AP_UnixApp::copyToClipboard | ( | PD_DocumentRange * | pDocRange, | |
bool | bUseClipboard = true | |||
) | [virtual] |
copy the given subset of the given document to the system clipboard in a variety of formats.
to minimize the effects of race-conditions, we create all of the buffers we need and then post them to the server (well sorta) all at one time.
pDocRange | a range of the document to be copied |
References AP_UnixClipboard::addHtmlData(), AP_UnixClipboard::addODTData(), AP_UnixClipboard::addPNGData(), AP_UnixClipboard::addRichTextData(), AP_UnixClipboard::addTextData(), IE_Exp::constructExporter(), IE_Exp_HTML::copyToBuffer(), IE_Exp::copyToBuffer(), DELETEP, IE_Exp::fileTypeForMimetype(), XAP_UnixClipboard::finishedAddingData(), UT_ByteBuf::getLength(), UT_ByteBuf::getPointer(), IEFT_Unknown, FV_View::isSelectionEmpty(), m_pClipboard, PD_DocumentRange::m_pDoc, FV_View::saveSelectedImage(), IE_Exp_HTML::set_HTML4(), XAP_UnixClipboard::TAG_ClipboardOnly, XAP_UnixClipboard::TAG_PrimaryOnly, and UT_DEBUGMSG.
virtual void AP_UnixApp::deleteClipboardFmt | ( | const char * | szFormat | ) | [inline, virtual] |
bool AP_UnixApp::doWindowlessArgs | ( | const AP_Args * | Args, | |
bool & | bSuccess | |||
) | [virtual] |
A callback for AP_Args's doWindowlessArgs call which handles platform-specific windowless args.
Reimplemented from AP_App.
References XAP_UnixApp::GEOMETRY_FLAG_SIZE, AP_Args::getApp(), XAP_StringSet::getValue(), AP_Args::m_iToThumb, m_pStringSet, AP_Args::m_sFiles, AP_Args::m_sGeometry, AP_Args::m_sPrintTo, and AP_App::openCmdLinePlugins().
void AP_UnixApp::errorMsgBadArg | ( | const char * | msg | ) | [virtual] |
void AP_UnixApp::errorMsgBadFile | ( | XAP_Frame * | pFrame, | |
const char * | file, | |||
UT_Error | error | |||
) | [virtual] |
Reimplemented from AP_App.
References s_CouldNotLoadFileMessage().
bool AP_UnixApp::forgetFrame | ( | XAP_Frame * | pFrame | ) | [virtual] |
we intercept this so that we can erase our selection-related variables if necessary. wouldn't want to hold onto a stale frame or view pointer of a closed window when the selection is changed....
/param pFrame The frame to be forgotten /return The return value of the XAP_App::forgetFrame call /sa XAP_App::forgetFrame()
References XAP_UnixClipboard::clearData(), m_pClipboard, m_pFrameSelection, and m_pViewSelection.
const char * AP_UnixApp::getAbiSuiteAppDir | ( | void | ) | const [virtual] |
This returns the AbiSuite application directory.
Referenced by getPrefsValueDirectory().
const std::string & AP_UnixApp::getAbiSuiteAppUIDir | ( | void | ) | const [virtual] |
This returns the directory that holds the application UI files.
virtual XAP_UnixClipboard* AP_UnixApp::getClipboard | ( | ) | [inline, virtual] |
bool AP_UnixApp::getCurrentSelection | ( | const char ** | formatList, | |
void ** | ppData, | |||
UT_uint32 * | pLen, | |||
const char ** | pszFormatFound | |||
) | [virtual] |
get the current contents of the selection in the window last known to have a selection using one of the formats in the given list.
formatList | the list of acceptable formats | |
ppData | ||
pLen | a pointer to an integer representing the length | |
pszFormatFound | a pointer for the data to be returned in |
References IE_Exp_HTML::copyToBuffer(), IE_Exp::copyToBuffer(), DELETEP, FV_View::getDocumentRangeOfCurrentSelection(), UT_ByteBuf::getLength(), UT_ByteBuf::getPointer(), UT_ByteBuf::ins(), AP_UnixClipboard::isHTMLTag(), AP_UnixClipboard::isImageTag(), AP_UnixClipboard::isRichTextTag(), FV_View::isSelectionEmpty(), AP_UnixClipboard::isTextTag(), m_bHasSelection, m_cacheDocumentRangeOfSelection, m_cacheSelectionView, PD_DocumentRange::m_pDoc, m_pFrameSelection, m_pViewSelection, m_selectionByteBuf, FV_View::saveSelectedImage(), IE_Exp_HTML::set_HTML4(), UT_ByteBuf::truncate(), and UT_DEBUGMSG.
bool AP_UnixApp::getPrefsValueDirectory | ( | bool | bAppSpecific, | |
const gchar * | szKey, | |||
const gchar ** | pszValue | |||
) | const [virtual] |
This function returns the absolute path to the directory specified in the desired key. In other words, if you want the path to the spelling files, you can't just get the prefs value, since that path isn't always absolute. This function gives it to you in absolute terms.
bAppSpecific | Is this key specific to the app, or is it general to AbiSuite? | |
szKey | A string of gchars representing the desired key | |
pszValue | pointer for the value to be returned in. |
References gchar, getAbiSuiteAppDir(), and UT_ASSERT.
Referenced by loadStringsFromDisk().
const XAP_StringSet * AP_UnixApp::getStringSet | ( | void | ) | const [virtual] |
This returns the current StringSet
References m_pStringSet.
virtual AV_View* AP_UnixApp::getViewSelection | ( | void | ) | [inline, virtual] |
Gets the View Selection
bool AP_UnixApp::initialize | ( | bool | has_display | ) | [virtual] |
Initialize the application. This involves preferences, keybindings, toolbars, graphics, spelling and everything else.
Build a labelset so the plugins can add themselves to something ///
References abi_register_builtin_plugins(), abi_stock_init(), AP_CreateMenuActionSet(), AP_CreateToolbarActionSet(), AP_GetEditMethods(), AP_PREF_DEFAULT_StringSet, AP_PREF_KEY_StringSet, UT_String::c_str(), fp_FieldFmts, fp_FieldTypes, XAP_StringSet::getValue(), IE_ImpExp_RegisterXP(), XAP_UnixClipboard::initialize(), AP_App::initialize(), loadAllPlugins(), loadStringsFromDisk(), m_pClipboard, m_pStringSet, fp_FieldData::m_Tag, fp_FieldTypeData::m_Type, UT_ASSERT, UT_createDirectoryIfNecessary(), UT_getFallBackStringSetLocale(), UT_SHOULD_NOT_HAPPEN, and XAP_PREF_KEY_AutoLoadPlugins.
Referenced by init_platform(), libabiword_init(), libabiword_init_noargs(), and main().
void AP_UnixApp::loadAllPlugins | ( | ) |
References UT_String::c_str(), XAP_ModuleManager::instance(), is_so(), and UT_DEBUGMSG.
Referenced by initialize().
AP_DiskStringSet * AP_UnixApp::loadStringsFromDisk | ( | const char * | szStringSet, | |
AP_BuiltinStringSet * | pDefaultStringSet | |||
) |
Try loading a string-set.
szStringSet | Language id, e.g. de_AT | |
pDefaultStringSet | String set to be used for untranslated strings. |
References AP_PREF_KEY_StringSetDirectory, UT_String::c_str(), DELETEP, FREEP, getPrefsValueDirectory(), AP_DiskStringSet::loadStringsFromDisk(), XAP_DiskStringSet::setFallbackStringSet(), UT_String::size(), UT_ASSERT, UT_DEBUGMSG, and UT_return_val_if_fail.
Referenced by initialize().
int AP_UnixApp::main | ( | const char * | szAppName, | |
int | argc, | |||
char ** | argv | |||
) | [static] |
References AP_Args::addOptions(), AP_UnixApp(), UT_String::c_str(), AP_Args::doWindowlessArgs(), initialize(), instance, AP_App::openCmdLineFiles(), AP_Args::parseOptions(), shutdown(), and UT_DEBUGMSG.
Referenced by main().
bool AP_UnixApp::makePngPreview | ( | const char * | pszInFile, | |
const char * | pszPNGFile, | |||
UT_sint32 | iWidth, | |||
UT_sint32 | iHeight | |||
) |
References GR_Graphics::beginPaint(), GR_Painter::clearArea(), DELETEP, FV_View::draw(), GR_Graphics::endPaint(), abicollab::service::error(), AP_Preview_Abi::getView(), GR_UnixCairoGraphics::graphicsAllocator(), IEFT_Unknown, dg_DrawArgs::pG, PREVIEW_ZOOMED, PD_Document::readFromFile(), GR_CairoGraphics::setCairo(), GR_Graphics::tlu(), and UT_OK.
Referenced by AbiCommand::parseTokens().
GR_Graphics * AP_UnixApp::newDefaultScreenGraphics | ( | ) | const [virtual] |
XAP_Frame * AP_UnixApp::newFrame | ( | void | ) | [virtual] |
Create a new frame based on the current one.
References AP_UnixFrame::initialize().
void AP_UnixApp::pasteFromClipboard | ( | PD_DocumentRange * | pDocRange, | |
bool | bUseClipboard, | |||
bool | bHonorFormatting = true | |||
) | [virtual] |
paste from the system clipboard using the best-for-us format that is present. try to get the content in the order listed.
References FV_View::cmdInsertGraphic(), IE_Imp::constructImporter(), DELETEP, abicollab::service::error(), IE_Imp::fileTypeForMimetype(), AP_UnixClipboard::getSupportedData(), AP_UnixClipboard::getTextData(), AP_UnixClipboard::isDynamicTag(), AP_UnixClipboard::isHTMLTag(), AP_UnixClipboard::isImageTag(), AP_UnixClipboard::isRichTextTag(), IE_ImpGraphic::loadGraphic(), m_pClipboard, PD_DocumentRange::m_pDoc, IE_Imp_Text::pasteFromBuffer(), IE_Imp::pasteFromBuffer(), IE_Imp_XHTML::pasteFromBuffer(), IE_Imp_RTF::pasteFromBuffer(), IE_Imp_Text_Sniffer::recognizeContentsType(), XAP_UnixClipboard::TAG_ClipboardOnly, XAP_UnixClipboard::TAG_PrimaryOnly, UT_convert(), and UT_DEBUGMSG.
void AP_UnixApp::setSelectionStatus | ( | AV_View * | pView | ) | [virtual] |
this is called by the view-listeners when the state of the X Selection is changed by the user on one of our windows.
we need to notify the clipboard so that it can assert or release the X Selection.
we remember the last view that called us so that clearSelection() can do it's job when another application asserts the X Selection.
pView | The view to be changed. |
References XAP_UnixClipboard::assertSelection(), AV_View::getParentData(), AV_View::isSelectionEmpty(), m_bHasSelection, m_bSelectionInFlux, m_cacheDeferClear, m_cacheSelectionView, m_pClipboard, m_pFrameSelection, m_pViewSelection, setViewSelection(), and UT_ASSERT.
Referenced by ap_UnixViewListener::notify().
virtual void AP_UnixApp::setViewSelection | ( | AV_View * | pView | ) | [inline, virtual] |
Sets the view selection
pView | The veiw the selection view is to be set to. |
Referenced by setSelectionStatus().
bool AP_UnixApp::shutdown | ( | void | ) | [virtual] |
If the user has set the preferences to save them selves on shutdown, save them.
Referenced by libabiword_shutdown(), and main().
bool AP_UnixApp::m_bHasSelection [protected] |
Referenced by cacheCurrentSelection(), clearSelection(), getCurrentSelection(), and setSelectionStatus().
bool AP_UnixApp::m_bSelectionInFlux [protected] |
Referenced by clearSelection(), and setSelectionStatus().
bool AP_UnixApp::m_cacheDeferClear [protected] |
Referenced by cacheCurrentSelection(), and setSelectionStatus().
Referenced by cacheCurrentSelection(), and getCurrentSelection().
AV_View* AP_UnixApp::m_cacheSelectionView [protected] |
Referenced by cacheCurrentSelection(), getCurrentSelection(), and setSelectionStatus().
AP_UnixClipboard* AP_UnixApp::m_pClipboard [protected] |
Referenced by canPasteFromClipboard(), copyToClipboard(), forgetFrame(), initialize(), pasteFromClipboard(), setSelectionStatus(), and ~AP_UnixApp().
XAP_Frame* AP_UnixApp::m_pFrameSelection [protected] |
Referenced by clearSelection(), forgetFrame(), getCurrentSelection(), and setSelectionStatus().
XAP_StringSet* AP_UnixApp::m_pStringSet [protected] |
Referenced by doWindowlessArgs(), getStringSet(), initialize(), and ~AP_UnixApp().
AV_View* AP_UnixApp::m_pViewSelection [protected] |
Referenced by clearSelection(), forgetFrame(), getCurrentSelection(), and setSelectionStatus().
UT_ByteBuf AP_UnixApp::m_selectionByteBuf [protected] |
Referenced by getCurrentSelection().