OpExportSets::ExportHighlightedIter Class Reference

Iterates over highlighted set items, re-exporting any that are export targets. More...

Inheritance diagram for OpExportSets::ExportHighlightedIter:

NameItemIter List of all members.

Public Member Functions

 ExportHighlightedIter (OpExportSets *pOp)
 Constructs an ExportHighlightedIter.
virtual ~ExportHighlightedIter ()
 Destroys an ExportHighlightedIter.

Protected Member Functions

virtual BOOL Do (SGNameItem *)
 Called for each SGNameItem that is highlighted in the Name Gallery.

Protected Attributes

OpExportSetsm_pOp
String_256 m_strExtErrors

Detailed Description

Iterates over highlighted set items, re-exporting any that are export targets.

> class CCAPI OpExpotrSets::ExportHighlightedIter : public NameItemIter

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/11/1999

Definition at line 359 of file ngsetop.h.


Constructor & Destructor Documentation

OpExportSets::ExportHighlightedIter::ExportHighlightedIter OpExportSets pOp  ) 
 

Constructs an ExportHighlightedIter.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/8/99
Parameters:
pOp --- required context for the exporting. [INPUTS]
See also:
OpExportSets; NameItemIter

Definition at line 772 of file ngsetop.cpp.

00773   : NameItemIter(NameItemIter::HIGHLIGHTED_NAMES),
00774     m_pOp(pOp)
00775 {
00776     // Save the selection.
00777     OpMenuExport::SaveSelection();
00778 }

OpExportSets::ExportHighlightedIter::~ExportHighlightedIter  )  [virtual]
 

Destroys an ExportHighlightedIter.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/8/99

Definition at line 790 of file ngsetop.cpp.

00791 {
00792     // Restore the selection.
00793     OpMenuExport::RestoreSelection();
00794 
00795     // Warn about any unexportable names.
00796     if (!m_strExtErrors.IsEmpty())
00797     {
00798         // Some implied extensions weren't recognised so warn about them.
00799         String_256 str;
00800         m_strExtErrors.toUpper();
00801         str.MakeMsg(_R(IDS_NAMEGAL_EXT_ERROR), &m_strExtErrors);
00802         Error::SetError(0, str, 0);
00803         InformWarning();
00804     }
00805 }


Member Function Documentation

BOOL OpExportSets::ExportHighlightedIter::Do SGNameItem pItem  )  [protected, virtual]
 

Called for each SGNameItem that is highlighted in the Name Gallery.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/8/99

Implements NameItemIter.

Definition at line 817 of file ngsetop.cpp.

00818 {
00819     // Skip if the set contains no objects.
00820     if (pItem->IsEmpty()) return TRUE;
00821     
00822     // Skip if the export property is not (yet) set up.
00823     NamedExportProp* pProp = (NamedExportProp*) pItem->GetProperty(NamedExportProp::nIndex);
00824     ERROR3IF(pProp == 0, "ExportHighlightedIter::Do: no export property");
00825 
00826     // if the user has not set the options themselves yet prompt them for a location
00827     if (pProp->IsVirgin())
00828     {
00829         if ( !pProp->ExportPropertiesToLocationDlg(pItem) )
00830             return FALSE;
00831 
00832         // pItem may have been altered in the above call
00833         // and we need to refer to the new state
00834         pProp = (NamedExportProp*) pItem->GetProperty(NamedExportProp::nIndex);
00835     }
00836 
00837     if (pProp->GetFilter() == 0 || !pProp->GetPath().IsValid())
00838     {
00839         // Build up a warning message over the course of the iteration.
00840         String_256 str;
00841         pItem->GetNameText(&str);
00842         PathName pth(str);
00843 
00844         if (!m_strExtErrors.IsEmpty()) m_strExtErrors += String(_R(IDS_NAMEGAL_EXT_COMMA));
00845         m_strExtErrors += pth.GetType();
00846         return TRUE;
00847     }
00848 
00849     // Clear out the selection and just select the given set.
00850     if (!SelectScan(pItem, SelectScan::SELECT_EXCLUSIVE, TRUE).Scan()) return FALSE;
00851 
00852     // Fix-up the bevel gubbins etc.
00853     OpMenuExport::NormaliseSelection();
00854 
00855     // Try to open a file.
00856     CCDiskFile theFile;
00857     if (!theFile.open(pProp->GetPath().GetPath(), ios::in | ios::out | ios::binary))
00858         return FALSE;
00859 
00860     // TODO: express-export the selection using the stored options.
00861     BOOL fOk = FALSE;
00862     if (pProp->GetFilter()->IS_KIND_OF(BaseBitmapFilter))
00863     {
00864         // never assume that the colours are the same so invalidate the palette
00865         // or indeed the thing may have changed size so flush the lot of cached data
00866         pProp->GetOptions()->BitmapSourceHasChanged();
00867         // do the export dance
00868         fOk = ((BaseBitmapFilter*) pProp->GetFilter())->DoExportWithOptions(
00869                                             m_pOp,
00870                                             &theFile,
00871                                             &pProp->GetPath(),
00872                                             m_pOp->GetWorkingDoc(),
00873                                             pProp->GetOptions());
00874     }
00875     
00876     // Tidy up and continue iterating if successful.
00877     theFile.close();
00878     return fOk;
00879 }


Member Data Documentation

OpExportSets* OpExportSets::ExportHighlightedIter::m_pOp [protected]
 

Definition at line 368 of file ngsetop.h.

String_256 OpExportSets::ExportHighlightedIter::m_strExtErrors [protected]
 

Definition at line 369 of file ngsetop.h.


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