From 5208a00b76f714e58590164ce84917571041ce28 Mon Sep 17 00:00:00 2001
From: Andre Fischer <af@openoffice.org>
Date: Thu, 14 Nov 2002 14:01:00 +0000
Subject: #105025# Pages not belonging to the current show are grayed out.

---
 sd/source/ui/dlg/sdtreelb.cxx | 41 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)

(limited to 'sd/source/ui/dlg/sdtreelb.cxx')

diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 4faf280cc798..a93702fb89c7 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: sdtreelb.cxx,v $
  *
- *  $Revision: 1.13 $
+ *  $Revision: 1.14 $
  *
- *  last change: $Author: iha $ $Date: 2002-09-26 10:01:42 $
+ *  last change: $Author: af $ $Date: 2002-11-14 15:01:00 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -84,6 +84,9 @@
 #ifndef _SVDOOLE2_HXX //autogen
 #include <svx/svdoole2.hxx>
 #endif
+#ifndef _SD_CUSSHOW_HXX
+#include "cusshow.hxx"
+#endif
 
 #include "strmname.h"
 #include "sdtreelb.hxx"
@@ -319,6 +322,9 @@ void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, BOOL bAllPages,
         {
             BOOL bPageExluded = pPage->IsExcluded();
 
+            bool bPageBelongsToShow = PageBelongsToCurrentShow (pPage);
+            bPageExluded |= !bPageBelongsToShow;
+
             pEntry = InsertEntry( pPage->GetName(),
                                     bPageExluded ? aImgPageExcl : aImgPage,
                                     bPageExluded ? aImgPageExcl : aImgPage );
@@ -1014,3 +1020,34 @@ IMPL_STATIC_LINK(SdPageObjsTLB, ExecDragHdl, void*, EMPTYARG)
 }
 
 
+bool SdPageObjsTLB::PageBelongsToCurrentShow (const SdPage* pPage) const
+{
+    // Return <TRUE/> as default when there is no custom show or when none
+    // is used.  The page does then belong to the standard show.
+    bool bBelongsToShow = true;
+
+    if (pDoc->IsCustomShow())
+    {
+        // Get the current custom show.
+        SdCustomShow* pCustomShow = NULL;
+        List* pShowList = const_cast<SdDrawDocument*>(pDoc)->GetCustomShowList();
+        if (pShowList != NULL)
+        {
+            ULONG nCurrentShowIndex = pShowList->GetCurPos();
+            void* pObject = pShowList->GetObject(nCurrentShowIndex);
+            pCustomShow = static_cast<SdCustomShow*>(pObject);
+        }
+
+        // Check whether the given page is part of that custom show.
+        if (pCustomShow != NULL)
+        {
+            bBelongsToShow = false;
+            ULONG nPageCount = pCustomShow->Count();
+            for (USHORT i=0; i<nPageCount && !bBelongsToShow; i++)
+                if (pPage == static_cast<SdPage*>(pCustomShow->GetObject (i)))
+                    bBelongsToShow = true;
+        }
+    }
+
+    return bBelongsToShow;
+}
-- 
cgit