OILFilterFamily Class Reference

Automate the production of the OIL parts of a filter family object. More...

#include <oilfltrs.h>

Inheritance diagram for OILFilterFamily:

OILFilter List of all members.

Public Member Functions

 OILFilterFamily (Filter *pFilter)
 OILFilterFamily (Filter *pFilter, UINT32 FilterNameID)
 Construct the OIL part of a filter family. This is basically the string resource that is the name of the filter, that appears in the COMMDLG import dialog box.
virtual TCHARConstructFilterString (UINT32 NumberToExport=1)
 Construct a COMMDLG filter definition string to put in the drop-down list of filters in the dialog box. This version gathers together all the extensions for a filter family.

Private Member Functions

 CC_DECLARE_MEMDUMP (OILFilterFamily)

Detailed Description

Automate the production of the OIL parts of a filter family object.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/07/94
See also:
FilterFamily

Definition at line 169 of file oilfltrs.h.


Constructor & Destructor Documentation

OILFilterFamily::OILFilterFamily Filter pFilter  ) 
 

OILFilterFamily::OILFilterFamily Filter pFilter,
UINT32  NameID
 

Construct the OIL part of a filter family. This is basically the string resource that is the name of the filter, that appears in the COMMDLG import dialog box.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/07/94
Parameters:
pFilter - the parent filter of this OILFilter [INPUTS] NameID - the string that describes this filter family.
See also:
OILFilter

Definition at line 539 of file oilfltrs.cpp.

00539                                                                : OILFilter(pFilter)
00540 {
00541     FilterName.Load( NameID );
00542 }


Member Function Documentation

OILFilterFamily::CC_DECLARE_MEMDUMP OILFilterFamily   )  [private]
 

TCHAR * OILFilterFamily::ConstructFilterString UINT32  NumberToExport = 1  )  [virtual]
 

Construct a COMMDLG filter definition string to put in the drop-down list of filters in the dialog box. This version gathers together all the extensions for a filter family.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/07/94
Returns:
Pointer to the string for this filter. This is a pointer to a static buffer, so it should be used immediately, and the caller should not attempt to deallocate this string.
See also:
OILFilter; OpMenuImport; OpMenuExport

Reimplemented from OILFilter.

Definition at line 561 of file oilfltrs.cpp.

00562 {
00563 #if !defined(EXCLUDE_FROM_RALPH)
00564     // Load in the filter name and extensions...
00565     static String_256 FilterStr;
00566     String_256 Extensions;
00567     FilterStr = FilterName;
00568 
00569     // Go through the filters and find out which ones to put in this family.
00570     ENSURE(Parent->IsKindOf(CC_RUNTIME_CLASS(FilterFamily)), "Bad parent filter");
00571 
00572     if (IS_A(Parent, GenericFilter))
00573     {
00574         // It's the generic filter - just use "*.*" as the extension mask.
00575         Extensions = _T("*.*");
00576     }
00577     else
00578     {
00579         // Run through all the filters and gather up all their extensions into a list.
00580         CCRuntimeClass *pFilterType = ((FilterFamily *) Parent)->pFilterType;
00581 
00582         Filter *pFilter = Filter::GetFirst();
00583 
00584         BOOL NoneFound = TRUE;
00585 
00586         while (pFilter != NULL)
00587         {
00588             if (pFilter->GetFlags().CanImport && pFilter->JoinFamily(pFilterType) &&
00589                 pFilter->GetFlags().ShowFilter)
00590             {
00591                 // This is an import filter which belongs to our family - add its
00592                 // extension list (unless it is already in out list).
00593                 String_32 ExtStr;
00594                 ExtStr = pFilter->pOILFilter->FilterExt;
00595 
00596                 // Extract each extension and see if we need to add it
00597                 TCHAR* pTemp = NULL;
00598                 TCHAR* pExt = camStrtok((TCHAR *) ExtStr, _T(","), &pTemp);
00599 
00600                 while (pExt != NULL)
00601                 {
00602                     if (camStrstr((TCHAR *) Extensions, pExt) == NULL)
00603                     {
00604                         // Not already present - add the string.
00605                         if (!NoneFound)
00606                             // Don't add a semi-colon if this is the first one we find.
00607                             Extensions += _T(";");
00608                         Extensions += _T("*.");
00609                         Extensions += pExt;
00610                         NoneFound = FALSE;
00611                     }
00612 
00613                     pExt = camStrtok(NULL, _T(","), &pTemp);
00614                 }
00615             }
00616 
00617             // Get the next filter.
00618             pFilter = Filter::GetNext(pFilter);
00619         }
00620     }
00621 
00622 
00623     // Construct the filter string from these two strings:
00624     FilterStr += _T("|");
00625     FilterStr += Extensions;
00626 
00627     // Return a pointer to the string.
00628     return (TCHAR *) FilterStr;
00629 #else
00630     return NULL;
00631 #endif
00632 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:57:20 2007 for Camelot by  doxygen 1.4.4