Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes

AP_Dialog_Lists Class Reference

#include <ap_Dialog_Lists.h>

Inheritance diagram for AP_Dialog_Lists:
AP_Dialog_Modeless XAP_Dialog_Modeless XAP_Dialog_AppPersistent XAP_Dialog_Persistent XAP_Dialog AP_CocoaDialog_Lists AP_UnixDialog_Lists AP_Win32Dialog_Lists

List of all members.

Public Types

enum  tAnswer { a_OK, a_QUIT, a_CLOSE }

Public Member Functions

 AP_Dialog_Lists (XAP_DialogFactory *pDlgFactory, XAP_Dialog_Id id)
virtual ~AP_Dialog_Lists (void)
AP_Dialog_Lists::tAnswer getAnswer (void) const
void setAnswer (AP_Dialog_Lists::tAnswer ans)
void StartList (void)
void StopList (void)
void Apply (void)
void fillDialogFromBlock (void)
void fillDialogFromVector (UT_GenericVector< const gchar * > *inVec)
void PopulateDialogData (void)
void fillFakeLabels (void)
bool isLastOnLevel (void)
gchar * getListStyleString (UT_uint32 iListType)
UT_uint32 decodeListType (char *listformat)
UT_sint32 findVecItem (UT_GenericVector< const gchar * > *v, const char *key)
void fillUncustomizedValues (void)
UT_uint32 getID (void)
UT_uint32 getStoredID (void)
fl_AutoNumPtr getAutoNum (void) const
fl_BlockLayoutgetBlock (void) const
UT_uint32 getTick (void)
const UT_VectorgetOutProps (void) const
void setTick (UT_uint32 iTick)
bool isDirty (void) const
void setDirty (void)
void clearDirty (void)
AV_ViewgetAvView (void)
void generateFakeLabels (void)
UT_UCSChargetListLabel (UT_sint32 itemNo)
virtual void event_PreviewAreaExposed ()
virtual void _createPreviewFromGC (GR_Graphics *gc, UT_uint32 width, UT_uint32 height)
void setModal (void)
bool isModal (void) const

Static Public Member Functions

static UT_sint32 findVecItem (const PP_PropertyVector &v, const char *key)
 XXX this should be moved out of here.

Protected Member Functions

virtual XAP_String_Id getWindowTitleStringId ()
 SET_GATHER (iLocalTick, UT_uint32)
 SET_GATHER (iStartValue, UT_uint32)
 SET_GATHER (newStartValue, UT_uint32)
 SET_GATHER (fAlign, float)
 SET_GATHER (fIndent, float)
 SET_GATHER (bStartNewList, bool)
 SET_GATHER (bApplyToCurrent, bool)
 SET_GATHER (bResumeList, bool)
 SET_GATHER (bisCustomized, bool)
 SET_GATHER (isListAtPoint, bool)
 SET_GATHER (bguiChanged, bool)
 SET_GATHER (NewListType, FL_ListType)
 SET_GATHER (DocListType, FL_ListType)
 SET_GATHER (iLevel, UT_uint32)
 SET_GATHER (pView, FV_View *)
void copyCharToDelim (const std::string &pszDelim)
const std::string & getDelim (void) const
void copyCharToDecimal (const std::string &pszDecimal)
const std::string & getDecimal (void) const
void copyCharToFont (const std::string &pszFont)
const std::string & getFont (void)
void copyCharToWindowName (const char *pszName)
const char * getWindowName () const
AP_Lists_previewgetListsPreview ()
void setCurrentFold (UT_sint32 iLevel)
UT_sint32 getCurrentFold (void)
virtual void setFoldLevelInGUI (void)=0
virtual bool isPageLists (void)=0
void setFoldingLevelChanged (bool b)

Private Attributes

tAnswer m_Answer
bool m_isListAtPoint
bool m_previousListExistsAtPoint
UT_UCSChar m_curListLabel [100]
UT_UCSChar m_newListLabel [100]
FL_ListType m_NewListType
std::string m_pszDelim
std::string m_pszDecimal
std::string m_pszFont
float m_fAlign
float m_fIndent
UT_uint32 m_iLevel
UT_uint32 m_iStartValue
UT_uint32 m_iWidth
UT_uint32 m_iHeight
UT_uint32 m_iLocalTick
UT_uint32 m_curStartValue
UT_uint32 m_newStartValue
UT_uint32 m_curListLevel
UT_uint32 m_newListLevel
UT_uint32 m_iID
FL_ListType m_DocListType
bool m_bStartList
bool m_bStartNewList
bool m_bApplyToCurrent
bool m_bResumeList
bool m_bisCustomized
bool m_bguiChanged
fl_Layoutm_pFakeLayout [4]
pf_Frag_Struxm_pFakeSdh [4]
fl_AutoNumPtr m_pFakeAuto
bool m_bDirty
bool m_bIsModal
UT_sint32 m_iCurrentLevel
UT_Vector m_OutProps
UT_String m_Output [5]
bool m_bFoldingLevelChanged

Member Enumeration Documentation


Reimplemented from AP_Dialog_Modeless.

Constructor & Destructor Documentation

AP_Dialog_Lists::~AP_Dialog_Lists ( void   )  [virtual]

Member Function Documentation

void AP_Dialog_Lists::_createPreviewFromGC ( GR_Graphics gc,
UT_uint32  width,
UT_uint32  height 
) [virtual]

Create the preview from the Graphics Context provided by the platform code.

gc the Platform Graphics Context cast into the a XP handle.
width the width of the gc
height the height of the gc

References DELETEP, generateFakeLabels(), getBlock(), fl_BlockLayout::isListItem(), m_iHeight, m_isListAtPoint, m_iWidth, m_NewListType, m_pListsPreview, XAP_Preview::setWindowSize(), and UT_return_if_fail.

Referenced by AP_Win32Dialog_Lists::_onInitDialog(), AP_UnixDialog_Lists::runModal(), AP_CocoaDialog_Lists::runModal, AP_UnixDialog_Lists::runModeless(), and AP_CocoaDialog_Lists::runModeless.

void AP_Dialog_Lists::Apply ( void   ) 

This method Does the stuff requested on the "action" button, "Apply" in the Modeless dialog and "OK" in the Modal dialog. Read comments with for all the stuff that can happen.

Just to make things even more confusing this method is also used in a Modal mannor by the styles dialog. This method is called when the users clicks "OK" on the modal dialog. When that happens we fill an output vector with all the properties currently defined.

If the "Apply to current" radio buton is chosen we have two options. 1. If "No list" is chosen we stop the current list at on this block. 2. Otherwise we change the current list to the type requested here. This piece of code changes the list style at the current point to the Style requested by the user.

This code stops the list at the current point.

Start new list. 4 Possibilities. 1. If there is a list at the current point and the user choose no list, stop the list the current point.

2. start a new list with the properties given if there is not a list at the current point.

3. Start a sublist at the current point if a list already exists there and contains two or more items.

4. Change the list to the requested value if a list already eists but only has one item in it.

OK Attach the block at this point to the previous list of the same margin.

References UT_GenericVector< T >::addItem(), AV_CHG_HDRFTR, AV_CHG_MOTION, PD_Document::beginUserAtomicGlob(), FV_View::changeListStyle(), UT_GenericVector< T >::clear(), clearDirty(), FV_View::cmdUnselectSelection(), DIM_IN, PD_Document::disableListUpdates(), PD_Document::enableListUpdates(), PD_Document::endUserAtomicGlob(), FV_View::ensureInsertionPointOnScreen(), gchar, getAutoNum(), fl_Layout::getAutoNum(), getBlock(), FV_View::getBlocksInSelection(), getCurrentFold(), fl_Layout::getDocument(), FV_View::getDocument(), UT_GenericVector< T >::getItemCount(), fl_BlockLayout::getLevel(), fl_BlockLayout::getListStyleString(), UT_GenericVector< T >::getNthItem(), FV_View::getPoint(), fl_ContainerLayout::getPrev(), fl_BlockLayout::getPreviousListOfSameMargin(), FV_View::getSelectionAnchor(), fl_Layout::getStruxDocHandle(), PD_Document::getStruxPosition(), PD_Document::getUID(), AP_Dialog_Modeless::getView(), fl_BlockLayout::isListItem(), isModal(), isPageLists(), UT_UniqueId::List, LIST_DEFAULT_INDENT, m_Answer, m_bApplyToCurrent, m_bFoldingLevelChanged, m_bResumeList, m_bStartNewList, m_fAlign, m_fIndent, m_isListAtPoint, m_iStartValue, m_NewListType, m_OutProps, m_Output, m_pszDecimal, m_pszDelim, m_pszFont, NOT_A_LIST, FV_View::notifyListeners(), fl_BlockLayout::resumeList(), FV_View::setCollapsedRange(), FV_View::setPoint(), fl_BlockLayout::StartList(), PD_Document::StopList(), PD_Document::updateDirtyLists(), FV_View::updateLayout(), FV_View::updateScreen(), UT_convertInchesToDimensionString(), and UT_std_string_sprintf().

Referenced by AP_Win32Dialog_Lists::_onApply(), AP_UnixDialog_Lists::applyClicked(), and AP_CocoaDialog_Lists::applyClicked.

void AP_Dialog_Lists::copyCharToDecimal ( const std::string &  pszDecimal  )  [inline, protected]
void AP_Dialog_Lists::copyCharToDelim ( const std::string &  pszDelim  )  [inline, protected]
void AP_Dialog_Lists::copyCharToFont ( const std::string &  pszFont  )  [inline, protected]
void AP_Dialog_Lists::copyCharToWindowName ( const char *  pszName  )  [protected]
UT_uint32 AP_Dialog_Lists::decodeListType ( char *  listformat  ) 
void AP_Dialog_Lists::event_PreviewAreaExposed ( void   )  [virtual]
void AP_Dialog_Lists::fillDialogFromVector ( UT_GenericVector< const gchar * > *  vp  ) 

The vector vp contains all the properties we need to fill our dialog variables. Fill our variables from this vector. This is used by the Modal dialog and is filled from the styles dialog.

References findVecItem(), getBlock(), UT_GenericVector< T >::getItemCount(), fl_BlockLayout::getListTypeFromStyle(), UT_GenericVector< T >::getNthItem(), LIST_DEFAULT_INDENT, LIST_DEFAULT_INDENT_LABEL, m_DocListType, m_fAlign, m_fIndent, m_iStartValue, m_NewListType, m_pszDecimal, m_pszDelim, m_pszFont, and UT_convertToInches().

Referenced by AP_Dialog_Styles::ModifyLists().

void AP_Dialog_Lists::fillFakeLabels ( void   ) 

This method sets the parameters of the "Fake" list shown in the preview. The values display are theones the user should expect to get in their document should they press "Apply"

m_bisCustomized is true if the user has changed anything in the dialog without pressing "Apply". If this variable is false we should just display what is in the document at the list point.

This method loads the list info from the document at the current point into the XP member variables.

OK fill the preview variables with what they need and load them into the preview class.

References getBlock(), fl_BlockLayout::getLevel(), isModal(), m_bguiChanged, m_bisCustomized, m_DocListType, m_fAlign, m_fIndent, m_iLevel, m_iStartValue, m_NewListType, m_pFakeAuto, m_pListsPreview, m_pszDecimal, m_pszDelim, m_pszFont, NOT_A_LIST, PopulateDialogData(), and AP_Lists_preview::setData().

Referenced by event_PreviewAreaExposed().

UT_sint32 AP_Dialog_Lists::findVecItem ( const PP_PropertyVector v,
const char *  key 
) [static]

XXX this should be moved out of here.

References ASSERT_PV_SIZE.

UT_sint32 AP_Dialog_Lists::findVecItem ( UT_GenericVector< const gchar * > *  v,
const char *  key 

This method returns the index to the value corresponding to the key in this props vector

References UT_GenericVector< T >::getItemCount(), and UT_GenericVector< T >::getNthItem().

Referenced by fillDialogFromBlock(), and fillDialogFromVector().

void AP_Dialog_Lists::generateFakeLabels ( void   ) 

This routine generates it's own AutoNum's and Layout pointers for use in the preview

References DELETEP, m_iID, m_NewListType, m_newStartValue, m_pFakeAuto, m_pFakeDoc, m_pFakeLayout, m_pFakeSdh, m_pszDecimal, m_pszDelim, fl_Layout::setAutoNum(), and UNREFP.

Referenced by _createPreviewFromGC().

AP_Dialog_Lists::tAnswer AP_Dialog_Lists::getAnswer ( void   )  const
fl_AutoNumPtr AP_Dialog_Lists::getAutoNum ( void   )  const
UT_sint32 AP_Dialog_Lists::getCurrentFold ( void   )  [inline, protected]
const std::string& AP_Dialog_Lists::getDecimal ( void   )  const [inline, protected]
const std::string& AP_Dialog_Lists::getDelim ( void   )  const [inline, protected]
const std::string& AP_Dialog_Lists::getFont ( void   )  [inline, protected]
UT_uint32 AP_Dialog_Lists::getID ( void   ) 

References getAutoNum(), and getBlock().

UT_UCSChar * AP_Dialog_Lists::getListLabel ( UT_sint32  itemNo  ) 

Little convienence method to get the List label from the FakeAutoNum used in the Preview.

References m_pFakeAuto, m_pFakeSdh, UT_ASSERT_HARMLESS, UT_MIN, and UT_UCS4_strlen().

Referenced by AP_Lists_preview::draw().

AP_Lists_preview* AP_Dialog_Lists::getListsPreview (  )  [inline, protected]
gchar* AP_Dialog_Lists::getListStyleString ( UT_uint32  iListType  ) 
const UT_Vector* AP_Dialog_Lists::getOutProps ( void   )  const [inline]
UT_uint32 AP_Dialog_Lists::getStoredID ( void   )  [inline]
UT_uint32 AP_Dialog_Lists::getTick ( void   ) 

This is the local cache of the change number reported in the AV_View. Only do an auto update if this number is different from the AV_View.

References m_iLocalTick.

Referenced by AP_Win32Dialog_Lists::autoupdateLists(), AP_UnixDialog_Lists::autoupdateLists(), AP_CocoaDialog_Lists::autoupdateLists, s_update(), and AP_CocoaDialog_ListsController::windowDidBecomeKey:.

XAP_String_Id AP_Dialog_Lists::getWindowTitleStringId (  )  [protected, virtual]

Implements AP_Dialog_Modeless.

bool AP_Dialog_Lists::isLastOnLevel ( void   ) 

References getAutoNum(), and getBlock().

virtual bool AP_Dialog_Lists::isPageLists ( void   )  [protected, pure virtual]

Implemented in AP_CocoaDialog_Lists, and AP_UnixDialog_Lists.

Referenced by Apply().

AP_Dialog_Lists::SET_GATHER ( iStartValue  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( iLocalTick  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( DocListType  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( bStartNewList  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( bisCustomized  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( bApplyToCurrent  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( fIndent  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( NewListType  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( newStartValue  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( bguiChanged  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( fAlign  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( iLevel  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( isListAtPoint  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( bResumeList  ,
) [protected]
AP_Dialog_Lists::SET_GATHER ( pView  ,
) [protected]
void AP_Dialog_Lists::setCurrentFold ( UT_sint32  iLevel  )  [inline, protected]
void AP_Dialog_Lists::setFoldingLevelChanged ( bool  b  )  [inline, protected]
virtual void AP_Dialog_Lists::setFoldLevelInGUI ( void   )  [protected, pure virtual]

Implemented in AP_CocoaDialog_Lists, and AP_UnixDialog_Lists.

Referenced by fillDialogFromBlock().

void AP_Dialog_Lists::setModal ( void   )  [inline]
void AP_Dialog_Lists::setTick ( UT_uint32  iTick  ) 

This is the local cache of the change number reported in the AV_View. Only do an auto update if this number is different from the AV_View.

References m_iLocalTick.

Referenced by AP_Win32Dialog_Lists::autoupdateLists(), AP_UnixDialog_Lists::autoupdateLists(), AP_CocoaDialog_Lists::autoupdateLists, s_update(), and AP_CocoaDialog_ListsController::windowDidBecomeKey:.

void AP_Dialog_Lists::StopList ( void   ) 

Member Data Documentation

Referenced by Apply(), and getAnswer().

Referenced by Apply().

bool AP_Dialog_Lists::m_bDirty [private]

Referenced by Apply().

Referenced by fillFakeLabels().

Referenced by fillFakeLabels().

Referenced by Apply().

Referenced by Apply().

Referenced by Apply().

Referenced by Apply().

Reimplemented from AP_Dialog_Modeless.

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