clicarea.cpp

Go to the documentation of this file.
00001 // $Id: clicarea.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 // Imagemap class
00099 
00100 #include "camtypes.h"
00101 #include "clicarea.h"
00102 
00103 #include "webattr.h"        //For WebAddressAttribute::CopyString
00104 
00105 //#include "resimmap.h"     //The HTML Export resources
00106 //#include "hotlink.h"      //For _R(IDS_WEBADDRESS_SHORT_SELF)
00107 #include "filtimag.h"       //Because everything that's written is done by the ImagemapFilter
00108 //#include "app.h"          //For the pointer to the application - in camtypes.h [AUTOMATICALLY REMOVED]
00109 #include "filtrmgr.h"       //To find the ImagemapFilter
00110 
00111 
00112 CC_IMPLEMENT_DYNAMIC(ImagemapClickableArea, OverrideListItem)
00113 CC_IMPLEMENT_DYNAMIC(ImagemapClickableRectangle, ImagemapClickableArea)
00114 CC_IMPLEMENT_DYNAMIC(ImagemapClickableCircle, ImagemapClickableArea)
00115 CC_IMPLEMENT_DYNAMIC(ImagemapClickablePolygon, ImagemapClickableArea)
00116 
00117 /*************************************************
00118 
00119   ImagemapClickableArea
00120 
00121   ***********************************************/
00122 /********************************************************************************************
00123 
00124     ImagemapClickableArea::ImagemapClickableArea()
00125 
00126     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00127     Created:    15/4/97
00128     Inputs:     -
00129     Outputs:    -
00130     Purpose:    Default contructor
00131     
00132 ********************************************************************************************/
00133 
00134 ImagemapClickableArea::ImagemapClickableArea()
00135 {
00136     //Set our member variable pointers to NULL
00137     m_pcURL=m_pcFrame=NULL;
00138 }
00139 
00140 /********************************************************************************************
00141 
00142     ImagemapClickableArea::ImagemapClickableArea(TCHAR* pcURL, TCHAR* pcFrame)
00143 
00144     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00145     Created:    15/4/97
00146     Inputs:     pcURL, pcFrame - the strings to put in our member variables
00147     Outputs:    -
00148     Purpose:    Specific contructor
00149     
00150 ********************************************************************************************/
00151 
00152 ImagemapClickableArea::ImagemapClickableArea(TCHAR* pcURL, TCHAR* pcFrame)
00153 {
00154     //First set our member variables to NULL
00155     m_pcURL=m_pcFrame=NULL;
00156 
00157     //And copy the strings across
00158     WebAddressAttribute::CopyString(&m_pcURL, pcURL);
00159     WebAddressAttribute::CopyString(&m_pcFrame, pcFrame);
00160 }
00161 
00162 /********************************************************************************************
00163 
00164     ImagemapClickableArea::~ImagemapClickableArea()
00165 
00166     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00167     Created:    16/4/97
00168     Inputs:     -
00169     Outputs:    -
00170     Purpose:    Destructor
00171     
00172 ********************************************************************************************/
00173 
00174 ImagemapClickableArea::~ImagemapClickableArea()
00175 {
00176     //Delete our member variables if they exist
00177     if (m_pcURL)
00178         delete m_pcURL;
00179 
00180     if (m_pcFrame)
00181         delete m_pcFrame;
00182 }
00183 
00184 /********************************************************************************************
00185 
00186   ImagemapClickableArea::ImagemapClickableArea(const ImagemapClickableArea& icaCopy)
00187 
00188     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00189     Created:    16/4/97
00190     Inputs:     -
00191     Outputs:    -
00192     Purpose:    Copy constructor
00193     
00194 ********************************************************************************************/
00195 
00196 ImagemapClickableArea::ImagemapClickableArea(const ImagemapClickableArea& icaCopy)
00197 {
00198     //Simply use the assignment operator
00199     *this=icaCopy;
00200 
00201 }
00202 
00203 /********************************************************************************************
00204 
00205   ImagemapClickableArea& ImagemapClickableArea::operator=(const ImagemapClickableArea& icpCopy)
00206 
00207     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00208     Created:    16/4/97
00209     Inputs:     icpCopy
00210     Outputs:    -
00211     Purpose:    Assignment operator
00212     
00213 ********************************************************************************************/
00214 
00215 ImagemapClickableArea& ImagemapClickableArea::operator=(const ImagemapClickableArea& icaCopy)
00216 {
00217     //First set our member variables to NULL
00218     m_pcURL=m_pcFrame=NULL;
00219 
00220     //And copy the strings across
00221     WebAddressAttribute::CopyString(&m_pcURL, icaCopy.m_pcURL);
00222     WebAddressAttribute::CopyString(&m_pcFrame, icaCopy.m_pcFrame);
00223 
00224     return *this;
00225 
00226 }
00227 
00228 /********************************************************************************************
00229 
00230     INT32 ImagemapClickableArea::WriteURLAndFrame(CCLexFile* pfileToWrite, TCHAR* pcBuffer)
00231 
00232     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00233     Created:    15/4/97
00234     Inputs:     pfileToWrite    The file to write to
00235                 pcBuffer        The text buffer to write to
00236 
00237                 Either of the above may be NULL.
00238                 
00239     Returns:    The number of TCHARs written.
00240 
00241     Purpose:    Writes the URL and the frame targetting information.
00242 
00243                 If the frame is "_self", it will not be written out.
00244     
00245 ********************************************************************************************/
00246 
00247 INT32 ImagemapClickableArea::WriteURLAndFrame(CCLexFile* pfileToWrite, TCHAR* pcBuffer)
00248 {
00249     PORTNOTETRACE("other","ImagemapClickableArea::WriteURLAndFrame - do nothing");
00250 #ifndef EXCLUDE_FROM_XARALX
00251     //Keep a count of the characters we write out
00252     INT32 lCharsWritten=0;
00253 
00254     ImagemapFilter * pFilter = GetImagemapFilter();
00255     ERROR2IF(pFilter == NULL,lCharsWritten,"ImagemapClickableArea::WriteURLAndFrame no imagemap filter");
00256 
00257     //Write out HREF="..."
00258     if (m_pcURL)
00259         lCharsWritten += pFilter->WriteParameterInQuotes(_R(IDS_HTMLEXPORT_HREF), m_pcURL, pfileToWrite, pcBuffer);
00260 
00261     //Now, is the frame something other than "_self"?
00262     // Neville 21/8/97 removed the is self test as it is wrong, assumes default setting is self
00263     // Changed so that we output blank when a new default setting is seen
00264     if (m_pcFrame && !WebAddressAttribute::AreStringsEqual(m_pcFrame, String_256(_R(IDS_WEBADDRESS_SHORT_DEFAULT))))
00265     {
00266         //Yes. So write out TARGET="..."
00267         lCharsWritten += pFilter->WriteParameterInQuotes(_R(IDS_HTMLEXPORT_TARGET), m_pcFrame, pfileToWrite, pcBuffer);
00268     }
00269 
00270     //And return the number of characters we've written
00271     return lCharsWritten;
00272 #else
00273     return 0;
00274 #endif
00275 }
00276 
00277 /********************************************************************************************
00278 
00279     ImagemapFilter* ImagemapClickableArea::GetImagemapFilter()
00280 
00281     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00282     Created:    15/4/97
00283     Inputs:     -
00284                 
00285     Returns:    A pointer to the imagemap filter
00286 
00287     Purpose:    Finds the imagemap filter
00288     
00289 ********************************************************************************************/
00290 
00291 ImagemapFilter* ImagemapClickableArea::GetImagemapFilter()
00292 {
00293     //First find the filter manager
00294     FilterManager* pFilterManager=Camelot.GetFilterManager();
00295 
00296     //If we can't find it, return NULL
00297     if (pFilterManager==NULL)
00298         return NULL;
00299 
00300     //Otherwise, find the imagemap filter
00301     return (ImagemapFilter*) pFilterManager->FindFilterFromID(FILTERID_IMAGEMAP);
00302 }
00303 
00304 
00305 
00306 /*************************************************
00307 
00308   ImagemapClickableRectangle
00309 
00310   ***********************************************/
00311 
00312 /********************************************************************************************
00313 
00314     ImagemapClickableRectangle::ImagemapClickableRectangle() : ImagemapClickableArea()
00315 
00316     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00317     Created:    15/4/97
00318     Inputs:     -
00319     Outputs:    -
00320     Purpose:    Default constructor
00321     
00322 ********************************************************************************************/
00323 
00324 ImagemapClickableRectangle::ImagemapClickableRectangle() : ImagemapClickableArea()
00325 {
00326     m_rect=DocRect(0,0,0,0);
00327 }
00328 
00329 /********************************************************************************************
00330 
00331     ImagemapClickableRectangle::ImagemapClickableRectangle(DocRect rectNew, TCHAR* pcURL, TCHAR* pcFrame) 
00332         : ImagemapClickableArea(pcURL, pcFrame)
00333 
00334     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00335     Created:    15/4/97
00336     Inputs:     rectNew     The new rectangle to use
00337     Outputs:    -
00338     Purpose:    Specific constructor
00339     
00340 ********************************************************************************************/
00341 
00342 ImagemapClickableRectangle::ImagemapClickableRectangle(DocRect rectNew, TCHAR* pcURL, TCHAR* pcFrame) 
00343 : ImagemapClickableArea(pcURL, pcFrame)
00344 {
00345     m_rect=rectNew;
00346 }
00347 
00348 /********************************************************************************************
00349 
00350     INT32 Write(CCLexFile* pfileToWrite=NULL, TCHAR* pcBuffer=NULL)
00351 
00352     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00353     Created:    15/4/97
00354     Inputs:     pfileToWrite    The file to write to
00355                 pcBuffer        The text buffer to write to
00356 
00357                 Either of the above may be NULL.
00358                 
00359     Returns:    The number of TCHARs written.
00360 
00361     Purpose:    Writes this clickable area, in client-side imagemap form,
00362                 into the buffer or the file or both.
00363 
00364                 This function may be called with all parameters NULL, to find out how
00365                 many TCHARs will be written into the imagemap, and hence to find out
00366                 how long the text buffer must be
00367     
00368 ********************************************************************************************/
00369 
00370 INT32 ImagemapClickableRectangle::Write(CCLexFile* pfileToWrite, TCHAR* pcBuffer)
00371 {
00372     PORTNOTETRACE("other","ImagemapClickableArea::Write - do nothing");
00373 #ifndef EXCLUDE_FROM_XARALX
00374     //Keep a count of the characters we write out
00375     INT32 lCharsWritten = 0;
00376 
00377     ImagemapFilter * pFilter = GetImagemapFilter();
00378     ERROR2IF(pFilter == NULL,lCharsWritten,"ImagemapClickableRectangle::Write no imagemap filter");
00379 
00380     //First indent the text
00381     pFilter->Indent();
00382     lCharsWritten += pFilter->WriteIndent(pfileToWrite, pcBuffer);
00383 
00384     //And write out <AREA
00385     lCharsWritten += pFilter->WriteStartOfTag(_R(IDS_HTMLEXPORT_AREA), pfileToWrite, pcBuffer);
00386 
00387     //Now write out SHAPE=RECTANGLE
00388     lCharsWritten += pFilter->WriteParameter(_R(IDS_HTMLEXPORT_SHAPE), _R(IDS_HTMLEXPORT_RECTANGLE), pfileToWrite, pcBuffer);
00389 
00390     //Write out the URL and the FRAME
00391     lCharsWritten += WriteURLAndFrame(pfileToWrite, pcBuffer);
00392         
00393     //And write out our coords
00394     lCharsWritten += pFilter->WriteCoords(m_rect, m_pcFrame, pfileToWrite, pcBuffer);
00395 
00396     //And the end of the tag
00397     lCharsWritten += pFilter->WriteEndOfTag(pfileToWrite, pcBuffer);
00398 
00399     //Then reset the indent
00400     pFilter->Unindent();
00401 
00402     //And write out a new line
00403     lCharsWritten += pFilter->WriteEOL(pfileToWrite, pcBuffer);
00404 
00405     //And return the number of characters we've written
00406     return lCharsWritten;
00407 #else
00408     return 0;
00409 #endif
00410 }
00411 
00412 /********************************************************************************************
00413 
00414   BOOL ImagemapClickableRectangle::OverrideFromBelow(OverrideListItem* picaOther)
00415 
00416     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00417     Created:    15/4/97
00418     Inputs:     picaOther   The imagemap clickable area which we want to know
00419                             if it's overridden or not
00420                 
00421     Returns:    TRUE if this ImagemapClickableRectangle overrides picaOther
00422                 FALSE otherwise
00423 
00424     Purpose:    If this ImagemapClickableRectangle encloses (or is equal to) 
00425                 the bounding box of the other ImagemapClickableArea, and
00426                 both have the same URL and frame information, then we override
00427                 the other.
00428     
00429 ********************************************************************************************/
00430 
00431 BOOL ImagemapClickableRectangle::OverrideFromBelow(OverrideListItem* poliOther)
00432 {
00433     ERROR2IF(poliOther==NULL, FALSE, "ImagemapClickableRectangle::OverrideFromAbove passed NULL parameter");
00434 
00435     if (!poliOther->IsAClickableArea())
00436         return FALSE;
00437 
00438     ImagemapClickableArea* picaOther=(ImagemapClickableArea*) poliOther;
00439 
00440     //Get the bounding box of the other ImagemapClickableArea
00441     DocRect rectOther=picaOther->GetBoundingRect();
00442 
00443     //We override the other ImagemapClickableArea if we contain
00444     //its bounding box and if URL and frame strings are equal
00445     return (m_rect.ContainsRect(rectOther)
00446         && WebAddressAttribute::AreStringsEqual(m_pcURL, picaOther->m_pcURL)
00447         && WebAddressAttribute::AreStringsEqual(m_pcFrame, picaOther->m_pcFrame));
00448 
00449 }
00450 
00451 /*************************************************
00452 
00453   ImagemapClickableCircle
00454 
00455   ***********************************************/
00456 
00457   /********************************************************************************************
00458 
00459   ImagemapClickableCircle::ImagemapClickableCircle():ImagemapClickableArea()
00460 
00461     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00462     Created:    15/4/97
00463     Purpose:    Default constructor
00464     
00465 ********************************************************************************************/
00466 
00467 ImagemapClickableCircle::ImagemapClickableCircle() : ImagemapClickableArea()
00468 {
00469     m_dcCentre=DocCoord(0,0);
00470     m_lRadius=0;
00471 }
00472 
00473   
00474   /********************************************************************************************
00475 
00476     ImagemapClickableCircle::ImagemapClickableCircle(Path* ppthPath, TCHAR* pcURL, TCHAR* pcFrame) 
00477 : ImagemapClickableArea(pcURL, pcFrame)
00478 
00479     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00480     Created:    15/4/97
00481     Purpose:    Specific constructor
00482     
00483 ********************************************************************************************/
00484 
00485 ImagemapClickableCircle::ImagemapClickableCircle(Path* ppthPath, TCHAR* pcURL, TCHAR* pcFrame) 
00486 : ImagemapClickableArea(pcURL, pcFrame)
00487 {
00488     //If we have been passed a path
00489     if (ppthPath)
00490     {
00491         //Get its bounding box
00492         DocRect rectBounds=ppthPath->GetBoundingRect();
00493         
00494         //Then the centre of the circle is the centre of the bounding box
00495         m_dcCentre=DocCoord(rectBounds.lo.x/2 + rectBounds.hi.x/2, rectBounds.lo.y/2 + rectBounds.hi.y/2);
00496 
00497         //And the radius of the circle is half the width of the rectangle
00498         m_lRadius=rectBounds.Width()/2;
00499     }
00500     else
00501     {
00502         m_dcCentre=DocCoord(0,0);
00503         m_lRadius=0;
00504     }
00505 
00506 }
00507   
00508   /********************************************************************************************
00509 
00510     INT32 Write(CCLexFile* pfileToWrite=NULL, TCHAR* pcBuffer=NULL)
00511 
00512     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00513     Created:    15/4/97
00514     Inputs:     pfileToWrite    The file to write to
00515                 pcBuffer        The text buffer to write to
00516 
00517                 Either of the above may be NULL.
00518                 
00519     Returns:    The number of TCHARs written.
00520 
00521     Purpose:    Writes this clickable area, in client-side imagemap form,
00522                 into the buffer or the file or both.
00523 
00524                 This function may be called with all parameters NULL, to find out how
00525                 many TCHARs will be written into the imagemap, and hence to find out
00526                 how long the text buffer must be
00527     
00528 ********************************************************************************************/
00529 
00530 INT32 ImagemapClickableCircle::Write(CCLexFile* pfileToWrite,  TCHAR* pcBuffer)
00531 {
00532     PORTNOTETRACE("other","ImagemapClickableArea::Write - do nothing");
00533 #ifndef EXCLUDE_FROM_XARALX
00534     //Keep a count of the characters we write out
00535     INT32 lCharsWritten=0;
00536 
00537     ImagemapFilter * pFilter = GetImagemapFilter();
00538     ERROR2IF(pFilter == NULL,lCharsWritten,"ImagemapClickableCircle::Write no imagemap filter");
00539 
00540     //First indent the text
00541     pFilter->Indent();
00542     lCharsWritten += pFilter->WriteIndent(pfileToWrite, pcBuffer);
00543 
00544     //And write out <AREA
00545     lCharsWritten += pFilter->WriteStartOfTag(_R(IDS_HTMLEXPORT_AREA), pfileToWrite, pcBuffer);
00546 
00547     //Now write out SHAPE=CIRCLE
00548     lCharsWritten += pFilter->WriteParameter(_R(IDS_HTMLEXPORT_SHAPE), _R(IDS_HTMLEXPORT_CIRCLE), pfileToWrite, pcBuffer);
00549 
00550     //Write out the URL and the FRAME
00551     lCharsWritten += WriteURLAndFrame(pfileToWrite, pcBuffer);
00552 
00553     //And write out our coords
00554     lCharsWritten += pFilter->WriteCircleCoords(m_dcCentre, m_lRadius, m_pcFrame, pfileToWrite, pcBuffer);
00555 
00556     //And the end of the tag
00557     lCharsWritten += pFilter->WriteEndOfTag(pfileToWrite, pcBuffer);
00558 
00559     //Then reset the indent
00560     pFilter->Unindent();
00561 
00562     //And write out a new line
00563     lCharsWritten += pFilter->WriteEOL(pfileToWrite, pcBuffer);
00564     
00565     //And return the number of characters we've written
00566     return lCharsWritten;
00567 #else
00568     return 0;
00569 #endif
00570 }
00571 
00572 /********************************************************************************************
00573 
00574     DocRect ImagemapClickableCircle::GetBoundingRect()
00575 
00576     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00577     Created:    1/5/97  - VOTE LABOUR!
00578     Inputs:     -
00579                 
00580     Returns:    The bounding rectangle of the circle
00581 
00582     Purpose:    Gets the bounding rectangle
00583     
00584 ********************************************************************************************/
00585 
00586 DocRect ImagemapClickableCircle::GetBoundingRect()
00587 {
00588     return DocRect(m_dcCentre.x-m_lRadius, m_dcCentre.y-m_lRadius, 
00589         m_dcCentre.x+m_lRadius, m_dcCentre.y+m_lRadius);
00590 }
00591 
00592 
00593 /*************************************************
00594 
00595   ImagemapClickablePolygon
00596 
00597   ***********************************************/
00598 
00599 /********************************************************************************************
00600 
00601     ImagemapClickablePolygon::ImagemapClickablePolygon() : ImagemapClickableArea()
00602 
00603     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00604     Created:    15/4/97
00605     Inputs:     -
00606     Outputs:    -
00607     Purpose:    Default contructor
00608     
00609 ********************************************************************************************/
00610 
00611 ImagemapClickablePolygon::ImagemapClickablePolygon() : ImagemapClickableArea()
00612 {
00613     m_ppth=NULL;
00614 }
00615 
00616 /********************************************************************************************
00617 
00618     ImagemapClickablePolygon::ImagemapClickablePolygon(Path* ppthPath)
00619 
00620     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00621     Created:    15/4/97
00622     Inputs:     ppthPath - pointer to the path to copy
00623     Outputs:    -
00624     Purpose:    Specific contructor
00625     
00626 ********************************************************************************************/
00627 
00628 ImagemapClickablePolygon::ImagemapClickablePolygon(Path* ppthPath, TCHAR* pcURL, TCHAR* pcFrame) 
00629     : ImagemapClickableArea(pcURL, pcFrame)
00630 {
00631     //Create a new path member variable
00632     m_ppth=new Path();
00633 
00634     //Initialise it
00635     m_ppth->Initialise(ppthPath->GetNumCoords());
00636 
00637     //And copy the path we have been given
00638     m_ppth->CopyPathDataFrom(ppthPath);
00639 }
00640 
00641 /********************************************************************************************
00642 
00643     ImagemapClickablePolygon::~ImagemapClickablePolygon()
00644 
00645     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00646     Created:    16/4/97
00647     Inputs:     -
00648     Outputs:    -
00649     Purpose:    Destructor
00650     
00651 ********************************************************************************************/
00652 
00653 ImagemapClickablePolygon::~ImagemapClickablePolygon()
00654 {
00655     //If we have a path member variable, delete it
00656     if (m_ppth)
00657         delete m_ppth;
00658 }
00659 
00660 /********************************************************************************************
00661 
00662   ImagemapClickablePolygon::ImagemapClickablePolygon(const ImagemapClickablePolygon& waaCopy);
00663 
00664     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00665     Created:    16/4/97
00666     Inputs:     -
00667     Outputs:    -
00668     Purpose:    Copy constructor
00669     
00670 ********************************************************************************************/
00671 
00672 ImagemapClickablePolygon::ImagemapClickablePolygon(const ImagemapClickablePolygon& icpCopy)
00673 :ImagemapClickableArea(icpCopy)
00674 {
00675     //Simply use the assignment operator
00676     *this=icpCopy;
00677 
00678 }
00679 
00680 /********************************************************************************************
00681 
00682   ImagemapClickablePolygon& ImagemapClickablePolygon::operator=(const ImagemapClickablePolygon& icpCopy)
00683 
00684     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00685     Created:    16/4/97
00686     Inputs:     icpCopy
00687     Outputs:    -
00688     Purpose:    Assignment operator
00689     
00690 ********************************************************************************************/
00691 
00692 ImagemapClickablePolygon& ImagemapClickablePolygon::operator=(const ImagemapClickablePolygon& icpCopy)
00693 {
00694     //Delete our member variable path
00695     if (m_ppth)
00696         delete m_ppth;
00697         
00698     //Now, does the other ICP have a member path variable?
00699     if (icpCopy.m_ppth!=NULL)
00700     {
00701         //Yes. So create a new path member variable
00702         m_ppth=new Path();
00703         
00704         //Initialise it
00705         m_ppth->Initialise(icpCopy.m_ppth->GetNumCoords());
00706 
00707         //And copy the path we have been given
00708         m_ppth->CopyPathDataFrom(icpCopy.m_ppth);
00709     }
00710     else
00711     {
00712         //No. So set our member path pointer to NULL
00713         m_ppth=NULL;
00714     }
00715 
00716     return *this;
00717 
00718 }
00719 
00720 
00721 /********************************************************************************************
00722 
00723     INT32 ImagemapClickablePolygon::Write(CCLexFile* pfileToWrite, TCHAR* pcBuffer)
00724 
00725     Author:     Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
00726     Created:    15/4/97
00727     Inputs:     pfileToWrite    The file to write to
00728                 pcBuffer        The text buffer to write to
00729 
00730                 Either of the above may be NULL.
00731                 
00732     Returns:    The number of TCHARs written.
00733 
00734     Purpose:    Writes this clickable area, in client-side imagemap form,
00735                 into the buffer or the file or both.
00736 
00737                 This function may be called with all parameters NULL, to find out how
00738                 many TCHARs will be written into the imagemap, and hence to find out
00739                 how long the text buffer must be
00740     
00741 ********************************************************************************************/
00742 
00743 INT32 ImagemapClickablePolygon::Write(CCLexFile* pfileToWrite, TCHAR* pcBuffer)
00744 {
00745     PORTNOTETRACE("other","ImagemapClickableArea::Write - do nothing");
00746 #ifndef EXCLUDE_FROM_XARALX
00747     //Keep a count of the characters we write out
00748     INT32 lCharsWritten=0;
00749 
00750     ImagemapFilter * pFilter = GetImagemapFilter();
00751     ERROR2IF(pFilter == NULL,lCharsWritten,"ImagemapClickablePolygon::Write no imagemap filter");
00752 
00753     //First indent the text
00754     pFilter->Indent();
00755     lCharsWritten += pFilter->WriteIndent(pfileToWrite, pcBuffer);
00756 
00757     //And write out <AREA
00758     lCharsWritten += pFilter->WriteStartOfTag(_R(IDS_HTMLEXPORT_AREA), pfileToWrite, pcBuffer);
00759 
00760     //Now write out SHAPE=PATH
00761     lCharsWritten += pFilter->WriteParameter(_R(IDS_HTMLEXPORT_SHAPE), _R(IDS_HTMLEXPORT_POLYGON), pfileToWrite, pcBuffer);
00762 
00763     //Write out the URL and the FRAME
00764     lCharsWritten += WriteURLAndFrame(pfileToWrite, pcBuffer);
00765 
00766     //And write out our coords
00767     lCharsWritten += pFilter->WriteCoords(m_ppth, m_pcFrame, pfileToWrite, pcBuffer);
00768 
00769     //And the end of the tag
00770     lCharsWritten += pFilter->WriteEndOfTag(pfileToWrite, pcBuffer);
00771 
00772     //Then reset the indent
00773     pFilter->Unindent();
00774 
00775     //And write out a new line
00776     lCharsWritten += pFilter->WriteEOL(pfileToWrite, pcBuffer);
00777 
00778     //And return the number of characters we've written
00779     return lCharsWritten; */
00780 #else
00781     return 0;
00782 #endif
00783 }

Generated on Sat Nov 10 03:44:42 2007 for Camelot by  doxygen 1.4.4