Public Member Functions | Static Public Member Functions | Protected Attributes

AP_UnixApp Class Reference

#include <ap_UnixApp.h>

Inheritance diagram for AP_UnixApp:

List of all members.

Public Member Functions

 AP_UnixApp (const char *szAppName)
virtual ~AP_UnixApp ()
virtual bool initialize (bool has_display)
virtual XAP_FramenewFrame (void)
virtual bool forgetFrame (XAP_Frame *pFrame)
virtual GR_GraphicsnewDefaultScreenGraphics () const
virtual bool shutdown (void)
virtual bool getPrefsValueDirectory (bool bAppSpecific, const gchar *szKey, const gchar **pszValue) const
virtual const XAP_StringSetgetStringSet (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_ViewgetViewSelection (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_DiskStringSetloadStringsFromDisk (const char *szStringSet, AP_BuiltinStringSet *pFallbackStringSet)
virtual XAP_UnixClipboardgetClipboard ()

Static Public Member Functions

static int main (const char *szAppName, int argc, char **argv)

Protected Attributes

bool m_bHasSelection
bool m_bSelectionInFlux
bool m_cacheDeferClear
UT_ByteBuf m_selectionByteBuf
PD_DocumentRange m_cacheDocumentRangeOfSelection

Constructor & Destructor Documentation

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.

Member Function Documentation

virtual void AP_UnixApp::addClipboardFmt ( const char *  szFormat  )  [inline, virtual]
void AP_UnixApp::cacheCurrentSelection ( AV_View pView  )  [virtual]
bool AP_UnixApp::canPasteFromClipboard ( void   )  [virtual]
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]
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.

A const string containting the directory path

Referenced by getPrefsValueDirectory().

const std::string & AP_UnixApp::getAbiSuiteAppUIDir ( void   )  const [virtual]

This returns the directory that holds the application UI files.

A const string containting the directory path
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
pLen a pointer to an integer representing the length
pszFormatFound a pointer for the data to be returned in
True if successful, false otherwise.

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.
True if successful, false otherwise.
support meaningful return values.

References gchar, getAbiSuiteAppDir(), and UT_ASSERT.

Referenced by loadStringsFromDisk().

const XAP_StringSet * AP_UnixApp::getStringSet ( void   )  const [virtual]

This returns the current StringSet

A const pointer to the StringSet
This function should be inilined.

References m_pStringSet.

virtual AV_View* AP_UnixApp::getViewSelection ( void   )  [inline, virtual]

Gets the View Selection

The View currently selected.
bool AP_UnixApp::initialize ( bool  has_display  )  [virtual]

Initialize the application. This involves preferences, keybindings, toolbars, graphics, spelling and everything else.

True if successfully initalized, False otherwise. if false the app is unusable, and loading should not continue.
This function is 136 lines - way too long. Needs to be refactored, to use a buzzword.

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 (  ) 
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.
AP_DiskStringSet * on success, NULL if not found

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]
XAP_Frame * AP_UnixApp::newFrame ( void   )  [virtual]

Create a new frame based on the current one.

A pointer to the new frame.

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.

currently i have this set so that a ^v or Menu[Edit/Paste] will use the CLIPBOARD property and a MiddleMouseClick will use the PRIMARY property -- this seems to be the "X11 way" (sigh). consider having a preferences switch to allow ^v and Menu[Edit/Paste] to use the most recent property... this might be a nice way of unifying things -- or it might not -- this is probably an area for investigation or some usability testing.

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.

This function always returns true.
The return value should be fixed to check the return values of the functions it calls, and potentially handle errors. At a minimum, it should return false on errors.

Referenced by libabiword_shutdown(), and main().

Member Data Documentation

The documentation for this class was generated from the following files: