home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / chap01 / cosmo / document.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  16.2 KB  |  841 lines

  1. /*
  2.  * DOCUMENT.CPP
  3.  * Cosmo Chapter 1
  4.  *
  5.  * Implementation of the CCosmoDoc derivation of CDocument as
  6.  * well as an implementation of CPolylineAdviseSink.
  7.  *
  8.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  9.  *
  10.  * Kraig Brockschmidt, Microsoft
  11.  * Internet  :  kraigb@microsoft.com
  12.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  13.  */
  14.  
  15.  
  16. #include "cosmo.h"
  17.  
  18.  
  19. /*
  20.  * CCosmoDoc::CCosmoDoc
  21.  * CCosmoDoc::~CCosmoDoc
  22.  *
  23.  * Constructor Parameters:
  24.  *  hInst           HINSTANCE of the application.
  25.  *  pFR             PCFrame of the frame object.
  26.  *  pAdv            PCDocumentAdviseSink to notify on events
  27.  */
  28.  
  29. CCosmoDoc::CCosmoDoc(HINSTANCE hInst, PCFrame pFR
  30.     , PCDocumentAdviseSink pAdv)
  31.     : CDocument(hInst, pFR, pAdv)
  32.     {
  33.     m_pPL=NULL;
  34.     m_pPLAdv=NULL;
  35.     m_uPrevSize=SIZE_RESTORED;
  36.     return;
  37.     }
  38.  
  39.  
  40. CCosmoDoc::~CCosmoDoc(void)
  41.     {
  42.     //Clean up the allocations we did in Init
  43.     if (NULL!=m_pPL)
  44.         delete m_pPL;
  45.  
  46.     if (NULL!=m_pPLAdv)
  47.         delete m_pPLAdv;
  48.  
  49.     return;
  50.     }
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. /*
  58.  * CCosmoDoc::Init
  59.  *
  60.  * Purpose:
  61.  *  Initializes an already created document window.  The client
  62.  *  actually creates the window for us, then passes that here for
  63.  *  further initialization.
  64.  *
  65.  * Parameters:
  66.  *  pDI             PDOCUMENTINIT containing initialization
  67.  *                  parameters.
  68.  *
  69.  * Return Value:
  70.  *  BOOL            TRUE if the function succeeded, FALSE otherwise.
  71.  */
  72.  
  73. BOOL CCosmoDoc::Init(PDOCUMENTINIT pDI)
  74.     {
  75.     RECT        rc;
  76.  
  77.     //Change the stringtable range to our customization.
  78.     pDI->idsMin=IDS_DOCUMENTMIN;
  79.     pDI->idsMax=IDS_DOCUMENTMAX;
  80.  
  81.     //Do default initialization
  82.     if (!CDocument::Init(pDI))
  83.         return FALSE;
  84.  
  85.     //Add the Polyline stuff we need.
  86.     m_pPLAdv=new CPolylineAdviseSink(this);
  87.     m_pPL   =new CPolyline(m_hInst);
  88.  
  89.     //Attempt to create our contained Polyline.
  90.     GetClientRect(m_hWnd, &rc);
  91.     InflateRect(&rc, -8, -8);
  92.  
  93.     if (!m_pPL->Init(m_hWnd, &rc, WS_CHILD | WS_VISIBLE
  94.         , ID_POLYLINE, m_pPLAdv))
  95.         return FALSE;
  96.  
  97.     return TRUE;
  98.     }
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106. /*
  107.  * CCosmoDoc::FMessageHook
  108.  *
  109.  * Purpose:
  110.  *  Processes WM_SIZE for the document so we can resize
  111.  *  the Polyline.
  112.  *
  113.  * Parameters:
  114.  *  <WndProc Parameters>
  115.  *  pLRes           LRESULT * in which to store the return
  116.  *                  value for the message.
  117.  *
  118.  * Return Value:
  119.  *  BOOL            TRUE to prevent further processing,
  120.  *                  FALSE otherwise.
  121.  */
  122.  
  123. BOOL CCosmoDoc::FMessageHook(HWND hWnd, UINT iMsg, WPARAM wParam
  124.     , LPARAM lParam, LRESULT *pLRes)
  125.     {
  126.     UINT        dx, dy;
  127.     RECT        rc;
  128.  
  129.     *pLRes=0;
  130.  
  131.     if (WM_SIZE==iMsg)
  132.         {
  133.         //Don't effect the Polyline size to or from minimized state.
  134.         if (SIZE_MINIMIZED!=wParam && SIZE_MINIMIZED !=m_uPrevSize)
  135.             {
  136.             //When we change size, resize any Polyline we hold.
  137.             dx=LOWORD(lParam);
  138.             dy=HIWORD(lParam);
  139.  
  140.             /*
  141.              * If we are getting WM_SIZE in response to a Polyline
  142.              * notification, then don't resize the Polyline window
  143.              * again.
  144.              */
  145.             if (!m_fNoSize && NULL!=m_pPL)
  146.                 {
  147.                 //Resize the polyline to fit the new client
  148.                 SetRect(&rc, 8, 8, dx-8, dy-8);
  149.                 m_pPL->RectSet(&rc, FALSE);
  150.  
  151.                 /*
  152.                  * We consider sizing something that makes the file
  153.                  * dirty, but not until we've finished the create
  154.                  * process, which is why we set fNoDirty to FALSE
  155.                  * in WM_CREATE since we get a WM_SIZE on the first
  156.                  * creation.
  157.                  */
  158.                 if (!m_fNoDirty)
  159.                     FDirtySet(TRUE);
  160.  
  161.                 SetRect(&rc, 0, 0, dx, dy);
  162.  
  163.                 if (NULL!=m_pAdv)
  164.                     m_pAdv->OnSizeChange(this, &rc);
  165.  
  166.                 m_fNoDirty=FALSE;
  167.                 }
  168.             }
  169.  
  170.         m_uPrevSize=wParam;
  171.         }
  172.  
  173.     /*
  174.      * We return FALSE even on WM_SIZE so we can let the default
  175.      * procedure handle maximized MDI child windows appropriately.
  176.      */
  177.     return FALSE;
  178.     }
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187. /*
  188.  * CCosmoDoc::Clear
  189.  *
  190.  * Purpose:
  191.  *  Sets all contents in the document back to defaults with
  192.  *  no filename.
  193.  *
  194.  * Paramters:
  195.  *  None
  196.  *
  197.  * Return Value:
  198.  *  None
  199.  */
  200.  
  201. void CCosmoDoc::Clear(void)
  202.     {
  203.     //Completely reset the polyline
  204.     m_pPL->New();
  205.  
  206.     CDocument::Clear();
  207.     m_lVer=0;
  208.     return;
  209.     }
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216. /*
  217.  * CCosmoDoc::Load
  218.  *
  219.  * Purpose:
  220.  *  Loads a given document without any user interface overwriting
  221.  *  the previous contents of the Polyline window.  We do this by
  222.  *  opening the file and telling the Polyline to load itself from
  223.  *  that file.
  224.  *
  225.  * Parameters:
  226.  *  fChangeFile     BOOL indicating if we're to update the window
  227.  *                  title and the filename from using this file.
  228.  *  pszFile         LPTSTR to the filename to load, NULL if the file
  229.  *                  is new and untitled.
  230.  *
  231.  * Return Value:
  232.  *  UINT            An error value from DOCERR_*
  233.  */
  234.  
  235. UINT CCosmoDoc::Load(BOOL fChangeFile, LPTSTR pszFile)
  236.     {
  237.     if (NULL==pszFile)
  238.         {
  239.         //For a new untitled document, just rename ourselves.
  240.         Rename(NULL);
  241.         m_lVer=VERSIONCURRENT;
  242.         return DOCERR_NONE;
  243.         }
  244.  
  245.     m_lVer=m_pPL->ReadFromFile(pszFile);
  246.  
  247.     if (POLYLINE_E_READFAILURE==m_lVer)
  248.         return DOCERR_READFAILURE;
  249.  
  250.     if (POLYLINE_E_UNSUPPORTEDVERSION==m_lVer)
  251.         return DOCERR_UNSUPPORTEDVERSION;
  252.  
  253.     if (fChangeFile)
  254.         Rename(pszFile);
  255.  
  256.     //Importing a file makes things dirty
  257.     FDirtySet(!fChangeFile);
  258.  
  259.     return DOCERR_NONE;
  260.     }
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. /*
  269.  * CCosmoDoc::Save
  270.  *
  271.  * Purpose:
  272.  *  Writes the file to a known filename, requiring that the user has
  273.  *  previously used FileOpen or FileSaveAs to provide a filename.
  274.  *
  275.  * Parameters:
  276.  *  uType           UINT indicating the type of file the user
  277.  *                  requested to save in the File Save As dialog.
  278.  *  pszFile         LPTSTR under which to save.  If NULL, use the
  279.  *                  current name.
  280.  *
  281.  * Return Value:
  282.  *  UINT            An error value from DOCERR_*
  283.  */
  284.  
  285. UINT CCosmoDoc::Save(UINT uType, LPTSTR pszFile)
  286.     {
  287.     LONG        lVer, lRet;
  288.     UINT        uTemp;
  289.     BOOL        fRename=TRUE;
  290.  
  291.     if (NULL==pszFile)
  292.         {
  293.         fRename=FALSE;
  294.         pszFile=m_szFile;
  295.         }
  296.  
  297.     /*
  298.      * Type 1 is the current version, type 2 is version 1.0 of the
  299.      * Polyline so we use this to send the right version to
  300.      * CPolyline::WriteToFile.
  301.      */
  302.  
  303.     switch (uType)
  304.         {
  305.         case 0:         //From Save, use loaded version.
  306.             lVer=m_lVer;
  307.             break;
  308.  
  309.         case 1:
  310.             lVer=VERSIONCURRENT;
  311.             break;
  312.  
  313.         case 2:
  314.             lVer=MAKELONG(0, 1);    //1.0
  315.             break;
  316.  
  317.         default:
  318.             return DOCERR_UNSUPPORTEDVERSION;
  319.         }
  320.  
  321.     /*
  322.      * If the version the user wants to save is different from the
  323.      * version that we loaded and m_lVer is not zero (new doc),
  324.      * then inform the user of the version change and verify.
  325.      */
  326.     if (0!=m_lVer && m_lVer!=lVer)
  327.         {
  328.         TCHAR       szMsg[128];
  329.  
  330.         wsprintf(szMsg, PSZ(IDS_VERSIONCHANGE)
  331.             , (UINT)HIWORD(m_lVer), (UINT)LOWORD(m_lVer)
  332.             , (UINT)HIWORD(lVer), (UINT)LOWORD(lVer));
  333.  
  334.         uTemp=MessageBox(m_hWnd, szMsg, PSZ(IDS_DOCUMENTCAPTION)
  335.             , MB_YESNOCANCEL);
  336.  
  337.         if (IDCANCEL==uTemp)
  338.             return DOCERR_CANCELLED;
  339.  
  340.         //If the user won't upgrade, revert to loaded version.
  341.         if (IDNO==uTemp)
  342.             lVer=m_lVer;
  343.         }
  344.  
  345.     lRet=m_pPL->WriteToFile(pszFile, lVer);
  346.  
  347.     if (POLYLINE_E_NONE!=lRet)
  348.         return DOCERR_WRITEFAILURE;
  349.  
  350.     //Saving makes us clean
  351.     FDirtySet(FALSE);
  352.  
  353.     //Update the known version of this document.
  354.     m_lVer=lVer;
  355.  
  356.     if (fRename)
  357.         Rename(pszFile);
  358.  
  359.     return DOCERR_NONE;
  360.     }
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367. /*
  368.  * CCosmoDoc::Undo
  369.  *
  370.  * Purpose:
  371.  *  Reverses a previous action.
  372.  *
  373.  * Parameters:
  374.  *  None
  375.  *
  376.  * Return Value:
  377.  *  None
  378.  */
  379.  
  380. void CCosmoDoc::Undo(void)
  381.     {
  382.     m_pPL->Undo();
  383.     return;
  384.     }
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391. /*
  392.  * CCosmoDoc::Clip
  393.  *
  394.  * Purpose:
  395.  *  Places a private format, a metafile, and a bitmap of the display
  396.  *  on the clipboard, optionally implementing Cut by deleting the
  397.  *  data in the current window after rendering.
  398.  *
  399.  * Parameters:
  400.  *  hWndFrame       HWND of the main window.
  401.  *  fCut            BOOL indicating cut (TRUE) or copy (FALSE).
  402.  *
  403.  * Return Value:
  404.  *  BOOL            TRUE if successful, FALSE otherwise.
  405.  */
  406.  
  407. BOOL CCosmoDoc::Clip(HWND hWndFrame, BOOL fCut)
  408.     {
  409.     BOOL            fRet=TRUE;
  410.     HGLOBAL         hMem;
  411.     UINT            i;
  412.  
  413.     //This array is so we can loop over the formats we provide.
  414.     static UINT     rgcf[3]={0, CF_METAFILEPICT, CF_BITMAP};
  415.     const UINT      cFormats=3;
  416.  
  417.     if (!OpenClipboard(hWndFrame))
  418.         return FALSE;
  419.  
  420.     //Clean out whatever junk is in the clipboard.
  421.     EmptyClipboard();
  422.  
  423.     rgcf[0]=m_cf;
  424.  
  425.     for (i=0; i < cFormats; i++)
  426.         {
  427.         //Copy private data first.
  428.         hMem=RenderFormat(rgcf[i]);
  429.  
  430.         if (NULL!=hMem)
  431.             SetClipboardData(rgcf[i], hMem);
  432.         else
  433.             fRet &=FALSE;
  434.         }
  435.  
  436.     //Free clipboard ownership.
  437.     CloseClipboard();
  438.  
  439.     //Delete our current data if "cut" succeeded.
  440.     if (fRet && fCut)
  441.         {
  442.         m_pPL->New();
  443.         FDirtySet(TRUE);
  444.         }
  445.  
  446.     return fRet;
  447.     }
  448.  
  449.  
  450.  
  451.  
  452.  
  453. /*
  454.  * CCosmoDoc::RenderFormat
  455.  *
  456.  * Purpose:
  457.  *  Renders a specific clipboard format into global memory.
  458.  *
  459.  * Parameters:
  460.  *  cf              UINT format to render.
  461.  *
  462.  * Return Value:
  463.  *  HGLOBAL         Global memory handle containing the data.
  464.  */
  465.  
  466. HGLOBAL CCosmoDoc::RenderFormat(UINT cf)
  467.     {
  468.     HGLOBAL     hMem;
  469.  
  470.     if (cf==m_cf)
  471.         {
  472.         m_pPL->DataGetMem(VERSIONCURRENT, &hMem);
  473.         return hMem;
  474.         }
  475.  
  476.     switch (cf)
  477.         {
  478.         case CF_METAFILEPICT:
  479.             return m_pPL->RenderMetafilePict();
  480.  
  481.         case CF_BITMAP:
  482.             return (HGLOBAL)m_pPL->RenderBitmap();
  483.         }
  484.  
  485.     return NULL;
  486.     }
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494. /*
  495.  * CCosmoDoc::FQueryPaste
  496.  *
  497.  * Purpose:
  498.  *  Determines if we can paste data from the clipboard.
  499.  *
  500.  * Parameters:
  501.  *  None
  502.  *
  503.  * Return Value:
  504.  *  BOOL            TRUE if data is available, FALSE otherwise.
  505.  */
  506.  
  507. BOOL CCosmoDoc::FQueryPaste(void)
  508.     {
  509.     return IsClipboardFormatAvailable(m_cf);
  510.     }
  511.  
  512.  
  513.  
  514.  
  515.  
  516. /*
  517.  * CCosmoDoc::Paste
  518.  *
  519.  * Purpose:
  520.  *  Retrieves the private data format from the clipboard and sets it
  521.  *  to the current figure in the editor window.
  522.  *
  523.  *  Note that if this function is called, then the clipboard format
  524.  *  is available because the Paste menu item is only enabled if the
  525.  *  format is present.
  526.  *
  527.  * Parameters:
  528.  *  hWndFrame       HWND of the main window.
  529.  *
  530.  * Return Value:
  531.  *  BOOL            TRUE if successful, FALSE otherwise.
  532.  */
  533.  
  534. BOOL CCosmoDoc::Paste(HWND hWndFrame)
  535.     {
  536.     HGLOBAL         hMem;
  537.     PPOLYLINEDATA   ppl;
  538.     BOOL            fRet=FALSE;
  539.  
  540.     if (!OpenClipboard(hWndFrame))
  541.         return FALSE;
  542.  
  543.     hMem=GetClipboardData(m_cf);
  544.  
  545.     if (NULL!=hMem)
  546.         {
  547.         ppl=(PPOLYLINEDATA)GlobalLock(hMem);
  548.  
  549.         //TRUE in wParam to cause PLN_SIZECHANGE notification
  550.         m_pPL->DataSet(ppl, FALSE, TRUE);
  551.         GlobalUnlock(hMem);
  552.  
  553.         FDirtySet(TRUE);
  554.         fRet=TRUE;
  555.         }
  556.  
  557.     CloseClipboard();
  558.     return fRet;
  559.     }
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566. /*
  567.  * CCosmoDoc::ColorSet
  568.  *
  569.  * Purpose:
  570.  *  Changes a color used in our contained Polyline.
  571.  *
  572.  * Parameters:
  573.  *  iColor          UINT index of the color to change.
  574.  *  cr              COLORREF new color.
  575.  *
  576.  * Return Value:
  577.  *  COLORREF        Previous color for the given index.
  578.  */
  579.  
  580. COLORREF CCosmoDoc::ColorSet(UINT iColor, COLORREF cr)
  581.     {
  582.     return m_pPL->ColorSet(iColor, cr);
  583.     }
  584.  
  585.  
  586.  
  587.  
  588.  
  589. /*
  590.  * CCosmoDoc::ColorGet
  591.  *
  592.  * Purpose:
  593.  *  Retrieves a color currently in use in the Polyline.
  594.  *
  595.  * Parameters:
  596.  *  iColor          UINT index of the color to retrieve.
  597.  *
  598.  * Return Value:
  599.  *  COLORREF        Current color for the given index.
  600.  */
  601.  
  602. COLORREF CCosmoDoc::ColorGet(UINT iColor)
  603.     {
  604.     return m_pPL->ColorGet(iColor);
  605.     }
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612. /*
  613.  * CCosmoDoc::LineStyleSet
  614.  *
  615.  * Purpose:
  616.  *  Changes the line style currently used in the Polyline
  617.  *
  618.  * Parameters:
  619.  *  iStyle          UINT index of the new line style to use.
  620.  *
  621.  * Return Value:
  622.  *  UINT            Previous line style.
  623.  */
  624.  
  625.  
  626. UINT CCosmoDoc::LineStyleSet(UINT iStyle)
  627.     {
  628.     return m_pPL->LineStyleSet(iStyle);
  629.     }
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637. /*
  638.  * CCosmoDoc::LineStyleGet
  639.  *
  640.  * Purpose:
  641.  *  Retrieves the line style currently used in the Polyline
  642.  *
  643.  * Parameters:
  644.  *  None
  645.  *
  646.  * Return Value:
  647.  *  UINT            Current line style.
  648.  */
  649.  
  650.  
  651. UINT CCosmoDoc::LineStyleGet(void)
  652.     {
  653.     if (NULL==m_pPL)    //m_pPL might not be valid yet
  654.         return 0L;
  655.  
  656.     return m_pPL->LineStyleGet();
  657.     }
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666. /*
  667.  * CPolylineAdviseSink::CPolylineAdviseSink
  668.  * CPolylineAdviseSink::~CPolylineAdviseSink
  669.  *
  670.  * Constructor Parameters:
  671.  *  pv              LPVOID to store in this object
  672.  */
  673.  
  674. CPolylineAdviseSink::CPolylineAdviseSink(LPVOID pv)
  675.     {
  676.     m_pv=pv;
  677.     return;
  678.     }
  679.  
  680.  
  681. CPolylineAdviseSink::~CPolylineAdviseSink(void)
  682.     {
  683.     return;
  684.     }
  685.  
  686.  
  687.  
  688.  
  689.  
  690. /*
  691.  * CPolylineAdviseSink::OnPointChange
  692.  *
  693.  * Purpose:
  694.  *  Informs the document that the polyline added or removed a point.
  695.  *
  696.  * Parameters:
  697.  *  None
  698.  *
  699.  * Return Value:
  700.  *  None
  701.  */
  702.  
  703. void CPolylineAdviseSink::OnPointChange(void)
  704.     {
  705.     PCDocument      pDoc=(PCDocument)m_pv;
  706.  
  707.     pDoc->FDirtySet(TRUE);
  708.     return;
  709.     }
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716. /*
  717.  * CPolylineAdviseSink::OnSizeChange
  718.  *
  719.  * Purpose:
  720.  *  Informs the document that the polyline changed size.
  721.  *
  722.  * Parameters:
  723.  *  None
  724.  *
  725.  * Return Value:
  726.  *  None
  727.  */
  728.  
  729. void CPolylineAdviseSink::OnSizeChange(void)
  730.     {
  731.     PCCosmoDoc      pDoc=(PCCosmoDoc)m_pv;
  732.     RECT            rc;
  733.     DWORD           dwStyle;
  734.  
  735.     /*
  736.      * Polyline window is informing us that it changed size in
  737.      * response to setting it's data.  Therefore we have to
  738.      * size ourselves accordingly but without moving the screen
  739.      * position of the polyline window.
  740.      */
  741.  
  742.     pDoc->m_fNoSize=TRUE;
  743.  
  744.     //Set the document window size.
  745.     GetWindowRect(pDoc->m_pPL->Window(), &rc);
  746.     InflateRect(&rc, 8, 8);
  747.  
  748.     //Adjust for a window sans menu
  749.     dwStyle=GetWindowLong(pDoc->m_hWnd, GWL_STYLE);
  750.     AdjustWindowRect(&rc, dwStyle, FALSE);
  751.  
  752.     SetWindowPos(pDoc->m_hWnd, NULL, 0, 0, rc.right-rc.left
  753.         , rc.bottom-rc.top, SWP_NOMOVE | SWP_NOZORDER);
  754.  
  755.     if (NULL!=pDoc->m_pAdv)
  756.         pDoc->m_pAdv->OnSizeChange(pDoc, &rc);
  757.  
  758.     pDoc->m_fNoSize=FALSE;
  759.     pDoc->FDirtySet(TRUE);
  760.  
  761.     return;
  762.     }
  763.  
  764.  
  765.  
  766.  
  767.  
  768. /*
  769.  * CPolylineAdviseSink::OnDataChange
  770.  *
  771.  * Purpose:
  772.  *  Informs the document that the polyline data changed.
  773.  *
  774.  * Parameters:
  775.  *  None
  776.  *
  777.  * Return Value:
  778.  *  None
  779.  */
  780.  
  781. void CPolylineAdviseSink::OnDataChange(void)
  782.     {
  783.     PCCosmoDoc      pDoc=(PCCosmoDoc)m_pv;
  784.  
  785.     if (NULL!=pDoc->m_pAdv)
  786.         pDoc->m_pAdv->OnDataChange(pDoc);
  787.  
  788.     pDoc->FDirtySet(TRUE);
  789.     return;
  790.     }
  791.  
  792.  
  793.  
  794.  
  795.  
  796. /*
  797.  * CPolylineAdviseSink::OnColorChange
  798.  *
  799.  * Purpose:
  800.  *  Informs the document that the polyline data changed a color.
  801.  *
  802.  * Parameters:
  803.  *  None
  804.  *
  805.  * Return Value:
  806.  *  None
  807.  */
  808.  
  809. void CPolylineAdviseSink::OnColorChange(void)
  810.     {
  811.     PCCosmoDoc      pDoc=(PCCosmoDoc)m_pv;
  812.  
  813.     pDoc->FDirtySet(TRUE);
  814.     return;
  815.     }
  816.  
  817.  
  818.  
  819.  
  820.  
  821. /*
  822.  * CPolylineAdviseSink::OnLineStyleChange
  823.  *
  824.  * Purpose:
  825.  *  Informs the document that the polyline changed its line style.
  826.  *
  827.  * Parameters:
  828.  *  None
  829.  *
  830.  * Return Value:
  831.  *  None
  832.  */
  833.  
  834. void CPolylineAdviseSink::OnLineStyleChange(void)
  835.     {
  836.     PCCosmoDoc      pDoc=(PCCosmoDoc)m_pv;
  837.  
  838.     pDoc->FDirtySet(TRUE);
  839.     return;
  840.     }
  841.