filtimop.cpp

Go to the documentation of this file.
00001 // $Id: filtimop.cpp 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 
00099 #include "camtypes.h"
00100 #include "filtimop.h"
00101 
00102 //#include "resimmap.h"     //For _R(IDS_IMAGEMAP_DEFAULTMAPNAME)
00103 //#include "app.h"          //For GetApplication() - in camtypes.h [AUTOMATICALLY REMOVED]
00104 #include "bitfilt.h"        //For GetSizeOfDrawing
00105 
00106 CC_IMPLEMENT_DYNAMIC(ImagemapFilterOptions, CCObject)
00107 
00108 #define new CAM_DEBUG_NEW
00109 
00110 
00111 /******************************************************
00112 
00113   Constructors
00114 
00115   *****************************************************/
00116 
00117 /********************************************************************************************
00118 
00119 >   ImagemapFilterOptions::ImagemapFilterOptions()
00120 
00121     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00122     Created:    9/4/97
00123     Purpose:    Default constructor
00124 
00125                 Note that this default constructor is used to set up the default
00126                 values on start up.
00127 
00128 ********************************************************************************************/
00129 ImagemapFilterOptions::ImagemapFilterOptions()
00130 {
00131     //Initialise our variables
00132     m_ffApprox=FF_APPROXIMATELY;
00133     m_fAllRectangles=FALSE;
00134     m_stExportArea=DRAWING;
00135     m_dDPI=96.0;
00136 
00137     m_fClipboard=FALSE;
00138     m_fFile=FALSE;
00139     m_fInsert=TRUE;
00140     m_pfileFile=NULL;
00141     m_fReportErrors=FALSE;
00142 }
00143 
00144 /********************************************************************************************
00145 
00146   ImagemapFilterOptions(String_256 strName,
00147                             FlatteningFactor ffApprox,
00148                             BOOL fAllRectangles,
00149                             SelectionType stExportArea,
00150                             double dDPI,
00151                             BOOL fClipboard,
00152                             BOOL fFile=FALSE,
00153                             PathName pthFile,
00154                             BOOL fInsert=FALSE,
00155                             CCLexFile* pfileFile,
00156                             BOOL fReportErrors
00157                             );
00158 
00159 
00160     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00161     Created:    9/4/97
00162     Purpose:    Specific constructor
00163 
00164 ********************************************************************************************/
00165 ImagemapFilterOptions::ImagemapFilterOptions(String_256 strName,
00166                             FlatteningFactor ffApprox,
00167                             BOOL fAllRectangles,
00168                             SelectionType stExportArea,
00169                             double dDPI,
00170                             BOOL fClipboard,
00171                             BOOL fFile,
00172                             PathName pthFile,
00173                             BOOL fInsert,
00174                             CCLexFile* pfileFile,
00175                             BOOL fReportErrors
00176                             )
00177 {
00178     //Initialise our variables
00179     m_strName=strName;
00180     m_ffApprox=ffApprox;
00181     m_fAllRectangles=fAllRectangles;
00182     m_stExportArea=stExportArea;
00183     m_dDPI=dDPI;
00184 
00185     m_fClipboard=fClipboard;
00186     m_fFile=fFile;
00187     m_pthFile=pthFile;
00188     m_fInsert=fInsert;
00189     m_pfileFile=pfileFile;
00190     m_fReportErrors=0;
00191     
00192     // init where the graphic is exported to
00193     // this makes a reasonable guess but should be set later
00194     m_GraphicPath = pthFile;
00195     m_GraphicPath.SetType("gif");
00196 }
00197 
00198 /******************************************************
00199 
00200   Copy constructor, destructor and assignment operator
00201 
00202   *****************************************************/
00203 /********************************************************************************************
00204 
00205 >   ImagemapFilterOptions::ImagemapFilterOptions(const ImagemapFilterOptions& waaCopy)
00206 
00207     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00208     Created:    9/4/97
00209     Inputs:     ImagemapFilterOptions object to copy
00210     Outputs:    -
00211     Returns:    *this
00212     Purpose:    Copy constructor
00213     Errors:     -
00214     SeeAlso:    -
00215 
00216 ********************************************************************************************/
00217 
00218 ImagemapFilterOptions::ImagemapFilterOptions(const ImagemapFilterOptions& ifoCopy)
00219 {
00220     //Simply use the assigment operator
00221     *this=ifoCopy;
00222                        
00223 }
00224 
00225 /********************************************************************************************
00226 
00227 >   ImagemapFilterOptions::~ImagemapFilterOptions()
00228 
00229     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00230     Created:    9/4/97
00231     Inputs:     -
00232     Outputs:    -
00233     Returns:    -
00234     Purpose:    Destructor
00235     Errors:     -                          
00236     SeeAlso:    -
00237 
00238 ********************************************************************************************/
00239 
00240 ImagemapFilterOptions::~ImagemapFilterOptions()
00241 {
00242     //Does nothing
00243 }
00244 
00245 /********************************************************************************************
00246 
00247 >   ImagemapFilterOptions& operator= (const ImagemapFilterOptions& ifoOther)                    
00248 
00249     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00250     Created:    9/4/97
00251     Inputs:     ifoOther    Object to copy
00252     Outputs:    -
00253     Returns:    -
00254     Purpose:    Assignment operator
00255     Errors:     -
00256     SeeAlso:    -
00257 
00258 ********************************************************************************************/
00259 
00260 ImagemapFilterOptions& ImagemapFilterOptions::operator= (const ImagemapFilterOptions& ifoOther)                 
00261 {
00262     
00263     //Simply copy the member variables across
00264     m_strName=ifoOther.m_strName;
00265     m_ffApprox=ifoOther.m_ffApprox;
00266     m_fAllRectangles=ifoOther.m_fAllRectangles;
00267     m_fClipboard=ifoOther.m_fClipboard;
00268     m_fFile=ifoOther.m_fFile;
00269     m_stExportArea=ifoOther.m_stExportArea;
00270     m_dDPI=ifoOther.m_dDPI;
00271     m_pthFile=ifoOther.m_pthFile;
00272     m_fInsert=ifoOther.m_fInsert;
00273     m_pfileFile=ifoOther.m_pfileFile;
00274     m_fReportErrors=ifoOther.m_fReportErrors;
00275     m_GraphicPath = ifoOther.m_GraphicPath;
00276 
00277     return *this;
00278 }
00279 
00280 /******************************************************
00281 
00282   Toolkit functions
00283 
00284   *****************************************************/
00285 /********************************************************************************************
00286 
00287     static DocRect ImagemapFilterOptions::GetSizeOfExportArea(SelectionType stExportArea)
00288 
00289     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00290     Created:    11/4/97
00291     Inputs:     -
00292     Outputs:    -
00293     Returns:    The bounding rectangle of the export area
00294     
00295     Purpose:    Returns the bounding rectangle of the export area, based
00296                 on the m_stExportArea member variable
00297     
00298                 Note that this function assumes there are only two types
00299                 of export area: the selection and the drawing.
00300 
00301     Errors:     -
00302     SeeAlso:    -
00303 
00304 ********************************************************************************************/
00305 
00306 DocRect ImagemapFilterOptions::GetSizeOfExportArea(SelectionType stExportArea)
00307 {   
00308     //This is the value we will return
00309     DocRect rectBounds;
00310 
00311     //If the area to export is the selection
00312     if (stExportArea==SELECTION)
00313     {
00314         //Then get the bounding rectangle of the selection
00315         rectBounds=GetApplication()->FindSelection()->GetBoundingRect();
00316     }
00317     else
00318     {
00319         //We assume the selection area is the drawing
00320         //Get the bounds of the drawing
00321         rectBounds=BaseBitmapFilter::GetSizeOfDrawing();
00322     }
00323 
00324     return rectBounds;
00325  
00326 }
00327 
00328 /********************************************************************************************
00329 
00330     DocCoord ImagemapFilterOptions::GetOriginOfExportArea(SelectionType stExportArea)
00331 
00332     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00333     Created:    11/4/97
00334     Inputs:     -
00335     Outputs:    -
00336     Returns:    The top left hand corner coordinate of the export area.
00337     
00338     Purpose:    Returns the top left hand corner of the export area - 
00339                 which is the origin from which all bitmap coordinates are
00340                 taken.
00341     
00342                 Note that this function assumes there are only two types
00343                 of export area: the selection and the drawing.
00344 
00345     Errors:     -
00346     SeeAlso:    ImagemapFilterOptions::GetSizeOfExportArea
00347 
00348 ********************************************************************************************/
00349 
00350 DocCoord ImagemapFilterOptions::GetOriginOfExportArea(SelectionType stExportArea)
00351 {   
00352     //Get the export area rectangle
00353     DocRect rectExport=ImagemapFilterOptions::GetSizeOfExportArea(stExportArea);
00354 
00355     //This is its top left hand corner
00356     DocCoord coordToReturn(rectExport.lo.x, rectExport.hi.y);
00357     
00358     return coordToReturn; 
00359 }
00360 

Generated on Sat Nov 10 03:45:19 2007 for Camelot by  doxygen 1.4.4