xref: /trunk/main/sc/source/ui/navipi/content.cxx (revision 0deba7fbda3d9908785c25a443701a293b6f4e71)
1b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3b3f79822SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4b3f79822SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5b3f79822SAndrew Rist  * distributed with this work for additional information
6b3f79822SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7b3f79822SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8b3f79822SAndrew Rist  * "License"); you may not use this file except in compliance
9b3f79822SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11b3f79822SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13b3f79822SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14b3f79822SAndrew Rist  * software distributed under the License is distributed on an
15b3f79822SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b3f79822SAndrew Rist  * KIND, either express or implied.  See the License for the
17b3f79822SAndrew Rist  * specific language governing permissions and limitations
18b3f79822SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20b3f79822SAndrew Rist  *************************************************************/
21b3f79822SAndrew Rist 
22b3f79822SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // INCLUDE ---------------------------------------------------------------
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <svx/svditer.hxx>
30cdf0e10cSrcweir #include <svx/svdobj.hxx>
31cdf0e10cSrcweir #include <svx/svdpage.hxx>
32cdf0e10cSrcweir #include <svx/svdpagv.hxx>
33cdf0e10cSrcweir #include <svx/svdview.hxx>
34cdf0e10cSrcweir #include <svx/svdxcgv.hxx>
35cdf0e10cSrcweir #include <sfx2/linkmgr.hxx>
36cdf0e10cSrcweir #include <sfx2/docfile.hxx>
37cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
38cdf0e10cSrcweir #include <vcl/help.hxx>
39cdf0e10cSrcweir #include <vcl/sound.hxx>
40cdf0e10cSrcweir #include <vcl/svapp.hxx>
41cdf0e10cSrcweir #include <tools/urlobj.hxx>
42cdf0e10cSrcweir #include <svl/urlbmk.hxx>
43cdf0e10cSrcweir #include <stdlib.h>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #include "content.hxx"
46cdf0e10cSrcweir #include "navipi.hxx"
47cdf0e10cSrcweir #include "global.hxx"
48cdf0e10cSrcweir #include "docsh.hxx"
49cdf0e10cSrcweir #include "scmod.hxx"
50cdf0e10cSrcweir #include "rangenam.hxx"
51cdf0e10cSrcweir #include "dbcolect.hxx"
52cdf0e10cSrcweir #include "tablink.hxx"          // fuer Loader
53cdf0e10cSrcweir #include "popmenu.hxx"
54cdf0e10cSrcweir #include "drwlayer.hxx"
55cdf0e10cSrcweir #include "transobj.hxx"
56cdf0e10cSrcweir #include "drwtrans.hxx"
57cdf0e10cSrcweir #include "lnktrans.hxx"
58cdf0e10cSrcweir #include "cell.hxx"
59cdf0e10cSrcweir #include "dociter.hxx"
60cdf0e10cSrcweir #include "scresid.hxx"
61cdf0e10cSrcweir #include "globstr.hrc"
62cdf0e10cSrcweir #include "navipi.hrc"
63cdf0e10cSrcweir #include "arealink.hxx"
64cdf0e10cSrcweir #include "navicfg.hxx"
65cdf0e10cSrcweir #include "navsett.hxx"
66cdf0e10cSrcweir #include "postit.hxx"
67*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
68*0deba7fbSSteve Yin #include "tabvwsh.hxx"
69*0deba7fbSSteve Yin #include "drawview.hxx"
70*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009
71cdf0e10cSrcweir #include "clipparam.hxx"
72cdf0e10cSrcweir 
73cdf0e10cSrcweir using namespace com::sun::star;
74cdf0e10cSrcweir 
75cdf0e10cSrcweir //  Reihenfolge der Kategorien im Navigator -------------------------------------
76cdf0e10cSrcweir 
77cdf0e10cSrcweir static sal_uInt16 pTypeList[SC_CONTENT_COUNT] =
78cdf0e10cSrcweir {
79cdf0e10cSrcweir     SC_CONTENT_ROOT,            // ROOT (0) muss vorne stehen
80cdf0e10cSrcweir     SC_CONTENT_TABLE,
81cdf0e10cSrcweir     SC_CONTENT_RANGENAME,
82cdf0e10cSrcweir     SC_CONTENT_DBAREA,
83cdf0e10cSrcweir     SC_CONTENT_AREALINK,
84cdf0e10cSrcweir     SC_CONTENT_GRAPHIC,
85cdf0e10cSrcweir     SC_CONTENT_OLEOBJECT,
86cdf0e10cSrcweir     SC_CONTENT_NOTE,
87cdf0e10cSrcweir     SC_CONTENT_DRAWING
88cdf0e10cSrcweir };
89cdf0e10cSrcweir 
90cdf0e10cSrcweir sal_Bool ScContentTree::bIsInDrag = sal_False;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 
93cdf0e10cSrcweir ScDocShell* ScContentTree::GetManualOrCurrent()
94cdf0e10cSrcweir {
95cdf0e10cSrcweir     ScDocShell* pSh = NULL;
96cdf0e10cSrcweir     if ( aManualDoc.Len() )
97cdf0e10cSrcweir     {
98cdf0e10cSrcweir         TypeId aScType = TYPE(ScDocShell);
99cdf0e10cSrcweir         SfxObjectShell* pObjSh = SfxObjectShell::GetFirst( &aScType );
100cdf0e10cSrcweir         while ( pObjSh && !pSh )
101cdf0e10cSrcweir         {
102cdf0e10cSrcweir             if ( pObjSh->GetTitle() == aManualDoc )
103cdf0e10cSrcweir                 pSh = PTR_CAST( ScDocShell, pObjSh );
104cdf0e10cSrcweir             pObjSh = SfxObjectShell::GetNext( *pObjSh, &aScType );
105cdf0e10cSrcweir         }
106cdf0e10cSrcweir     }
107cdf0e10cSrcweir     else
108cdf0e10cSrcweir     {
109cdf0e10cSrcweir         //  Current nur, wenn keine manuell eingestellt ist
110cdf0e10cSrcweir         //  (damit erkannt wird, wenn das Dokument nicht mehr existiert)
111cdf0e10cSrcweir 
112cdf0e10cSrcweir         SfxViewShell* pViewSh = SfxViewShell::Current();
113cdf0e10cSrcweir         if ( pViewSh )
114cdf0e10cSrcweir         {
115cdf0e10cSrcweir             SfxObjectShell* pObjSh = pViewSh->GetViewFrame()->GetObjectShell();
116cdf0e10cSrcweir             pSh = PTR_CAST( ScDocShell, pObjSh );
117cdf0e10cSrcweir         }
118cdf0e10cSrcweir     }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     return pSh;
121cdf0e10cSrcweir }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir //
124cdf0e10cSrcweir //          ScContentTree
125cdf0e10cSrcweir //
126cdf0e10cSrcweir 
127cdf0e10cSrcweir ScContentTree::ScContentTree( Window* pParent, const ResId& rResId ) :
128cdf0e10cSrcweir     SvTreeListBox   ( pParent, rResId ),
129cdf0e10cSrcweir     aEntryImages    ( ScResId( RID_IMAGELIST_NAVCONT ) ),
130cdf0e10cSrcweir     aHCEntryImages  ( ScResId( RID_IMAGELIST_H_NAVCONT ) ),
131cdf0e10cSrcweir     nRootType       ( SC_CONTENT_ROOT ),
132cdf0e10cSrcweir     bHiddenDoc      ( sal_False ),
133*0deba7fbSSteve Yin     pHiddenDocument ( NULL ),
134*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
135*0deba7fbSSteve Yin     bisInNavigatoeDlg  ( sal_False )
136*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009
137cdf0e10cSrcweir {
138cdf0e10cSrcweir     sal_uInt16 i;
139cdf0e10cSrcweir     for (i=0; i<SC_CONTENT_COUNT; i++)
140cdf0e10cSrcweir         pPosList[pTypeList[i]] = i;         // invers zum suchen
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     pParentWindow = (ScNavigatorDlg*)pParent;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     pRootNodes[0] = NULL;
145cdf0e10cSrcweir     for (i=1; i<SC_CONTENT_COUNT; i++)
146cdf0e10cSrcweir         InitRoot(i);
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     SetNodeDefaultImages();
149cdf0e10cSrcweir 
150cdf0e10cSrcweir     SetDoubleClickHdl( LINK( this, ScContentTree, ContentDoubleClickHdl ) );
151cdf0e10cSrcweir 
152*0deba7fbSSteve Yin     //IAccessibility2 Implementation 2009-----
153*0deba7fbSSteve Yin     pTmpEntry= NULL;
154*0deba7fbSSteve Yin     m_bFirstPaint=true;
155*0deba7fbSSteve Yin     //-----IAccessibility2 Implementation 2009
156*0deba7fbSSteve Yin 
157cdf0e10cSrcweir     SetStyle( GetStyle() | WB_QUICK_SEARCH );
158cdf0e10cSrcweir }
159cdf0e10cSrcweir 
160cdf0e10cSrcweir ScContentTree::~ScContentTree()
161cdf0e10cSrcweir {
162cdf0e10cSrcweir }
163*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
164*0deba7fbSSteve Yin // helper function for  GetEntryAltText and GetEntryLongDescription
165*0deba7fbSSteve Yin String ScContentTree::getAltLongDescText( SvLBoxEntry* pEntry , sal_Bool isAltText) const
166*0deba7fbSSteve Yin {
167*0deba7fbSSteve Yin     SdrObject* pFound = NULL;
168*0deba7fbSSteve Yin 
169*0deba7fbSSteve Yin     sal_uInt16 nType;
170*0deba7fbSSteve Yin     sal_uLong nChild;
171*0deba7fbSSteve Yin     GetEntryIndexes( nType, nChild, pEntry );
172*0deba7fbSSteve Yin     switch( nType )
173*0deba7fbSSteve Yin     {
174*0deba7fbSSteve Yin     case SC_CONTENT_OLEOBJECT:
175*0deba7fbSSteve Yin     case SC_CONTENT_GRAPHIC:
176*0deba7fbSSteve Yin     case SC_CONTENT_DRAWING:
177*0deba7fbSSteve Yin         {
178*0deba7fbSSteve Yin             ScDocument* pDoc = ( const_cast< ScContentTree* >(this) )->GetSourceDocument();
179*0deba7fbSSteve Yin             SdrIterMode eIter = ( nType == SC_CONTENT_DRAWING ) ? IM_FLAT : IM_DEEPNOGROUPS;
180*0deba7fbSSteve Yin             ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
181*0deba7fbSSteve Yin             SfxObjectShell* pShell = pDoc->GetDocumentShell();
182*0deba7fbSSteve Yin             if (pDrawLayer && pShell)
183*0deba7fbSSteve Yin             {
184*0deba7fbSSteve Yin                 sal_uInt16 nTabCount = pDoc->GetTableCount();
185*0deba7fbSSteve Yin                 for (sal_uInt16 nTab=0; nTab<nTabCount; nTab++)
186*0deba7fbSSteve Yin                 {
187*0deba7fbSSteve Yin                     SdrPage* pPage = pDrawLayer->GetPage(nTab);
188*0deba7fbSSteve Yin                     DBG_ASSERT(pPage,"Page ?");
189*0deba7fbSSteve Yin                     if (pPage)
190*0deba7fbSSteve Yin                     {
191*0deba7fbSSteve Yin                         SdrObjListIter aIter( *pPage, eIter );
192*0deba7fbSSteve Yin                         SdrObject* pObject = aIter.Next();
193*0deba7fbSSteve Yin                         while (pObject)
194*0deba7fbSSteve Yin                         {
195*0deba7fbSSteve Yin                             if( ScDrawLayer::GetVisibleName( pObject ) == GetEntryText( pEntry ) )
196*0deba7fbSSteve Yin                             {
197*0deba7fbSSteve Yin                                 pFound = pObject;
198*0deba7fbSSteve Yin                                 break;
199*0deba7fbSSteve Yin                             }
200*0deba7fbSSteve Yin                             pObject = aIter.Next();
201*0deba7fbSSteve Yin                         }
202*0deba7fbSSteve Yin                     }
203*0deba7fbSSteve Yin                 }
204*0deba7fbSSteve Yin             }
205*0deba7fbSSteve Yin              if( pFound )
206*0deba7fbSSteve Yin              {
207*0deba7fbSSteve Yin                 if( isAltText )
208*0deba7fbSSteve Yin                     return pFound->GetTitle();
209*0deba7fbSSteve Yin                 else
210*0deba7fbSSteve Yin                     return pFound->GetDescription();
211*0deba7fbSSteve Yin              }
212*0deba7fbSSteve Yin         }
213*0deba7fbSSteve Yin         break;
214*0deba7fbSSteve Yin     }
215*0deba7fbSSteve Yin     return String();
216*0deba7fbSSteve Yin }
217*0deba7fbSSteve Yin String  ScContentTree::GetEntryAltText( SvLBoxEntry* pEntry ) const
218*0deba7fbSSteve Yin {
219*0deba7fbSSteve Yin     return getAltLongDescText( pEntry, sal_True );
220*0deba7fbSSteve Yin }
221*0deba7fbSSteve Yin String ScContentTree::GetEntryLongDescription( SvLBoxEntry* pEntry ) const
222*0deba7fbSSteve Yin {
223*0deba7fbSSteve Yin     return getAltLongDescText( pEntry, sal_False);
224*0deba7fbSSteve Yin }
225*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009
226cdf0e10cSrcweir 
227cdf0e10cSrcweir void ScContentTree::InitRoot( sal_uInt16 nType )
228cdf0e10cSrcweir {
229cdf0e10cSrcweir     if ( !nType )
230cdf0e10cSrcweir         return;
231cdf0e10cSrcweir 
232cdf0e10cSrcweir     if ( nRootType && nRootType != nType )              // ausgeblendet ?
233cdf0e10cSrcweir     {
234cdf0e10cSrcweir         pRootNodes[nType] = NULL;
235cdf0e10cSrcweir         return;
236cdf0e10cSrcweir     }
237cdf0e10cSrcweir 
238cdf0e10cSrcweir     const Image& rImage = aEntryImages.GetImage( nType );
239cdf0e10cSrcweir     String aName( ScResId( SCSTR_CONTENT_ROOT + nType ) );
240cdf0e10cSrcweir     // wieder an die richtige Position:
241cdf0e10cSrcweir     sal_uInt16 nPos = nRootType ? 0 : pPosList[nType]-1;
242cdf0e10cSrcweir     SvLBoxEntry* pNew = InsertEntry( aName, rImage, rImage, NULL, sal_False, nPos );
243cdf0e10cSrcweir 
244cdf0e10cSrcweir     const Image& rHCImage = aHCEntryImages.GetImage( nType );
245cdf0e10cSrcweir     SetExpandedEntryBmp( pNew, rHCImage, BMP_COLOR_HIGHCONTRAST );
246cdf0e10cSrcweir     SetCollapsedEntryBmp( pNew, rHCImage, BMP_COLOR_HIGHCONTRAST );
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     pRootNodes[nType] = pNew;
249cdf0e10cSrcweir }
250cdf0e10cSrcweir 
251cdf0e10cSrcweir void ScContentTree::ClearAll()
252cdf0e10cSrcweir {
253*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
254*0deba7fbSSteve Yin     //There are one method in Control::SetUpdateMode(), and one override method SvTreeListBox::SetUpdateMode(). Here although
255*0deba7fbSSteve Yin     //SvTreeListBox::SetUpdateMode() is called in refresh method, it only call SvTreeListBox::SetUpdateMode(), not Control::SetUpdateMode().
256*0deba7fbSSteve Yin     //In SvTreeList::Clear(), Broadcast( LISTACTION_CLEARED ) will be called and finally, it will be trapped into the event yield() loop. And
257*0deba7fbSSteve Yin     //the InitRoot() method won't be called. Then if a user click or press key to update the navigator tree, crash happens.
258*0deba7fbSSteve Yin     //So the solution is to disable the UpdateMode of Control, then call Clear(), then recover the update mode
259*0deba7fbSSteve Yin     sal_Bool bOldUpdate = Control::IsUpdateMode();
260*0deba7fbSSteve Yin     Control::SetUpdateMode(sal_False);
261cdf0e10cSrcweir     Clear();
262*0deba7fbSSteve Yin     Control::SetUpdateMode(bOldUpdate);
263*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009
264cdf0e10cSrcweir     for (sal_uInt16 i=1; i<SC_CONTENT_COUNT; i++)
265cdf0e10cSrcweir         InitRoot(i);
266cdf0e10cSrcweir }
267cdf0e10cSrcweir 
268cdf0e10cSrcweir void ScContentTree::ClearType(sal_uInt16 nType)
269cdf0e10cSrcweir {
270cdf0e10cSrcweir     if (!nType)
271cdf0e10cSrcweir         ClearAll();
272cdf0e10cSrcweir     else
273cdf0e10cSrcweir     {
274cdf0e10cSrcweir         SvLBoxEntry* pParent = pRootNodes[nType];
275cdf0e10cSrcweir         if ( !pParent || GetChildCount(pParent) )       // nicht, wenn ohne Children schon da
276cdf0e10cSrcweir         {
277cdf0e10cSrcweir             if (pParent)
278cdf0e10cSrcweir                 GetModel()->Remove( pParent );          // mit allen Children
279cdf0e10cSrcweir             InitRoot( nType );                          // ggf. neu eintragen
280cdf0e10cSrcweir         }
281cdf0e10cSrcweir     }
282cdf0e10cSrcweir }
283cdf0e10cSrcweir 
284cdf0e10cSrcweir void ScContentTree::InsertContent( sal_uInt16 nType, const String& rValue )
285cdf0e10cSrcweir {
286cdf0e10cSrcweir     if (nType >= SC_CONTENT_COUNT)
287cdf0e10cSrcweir     {
288cdf0e10cSrcweir         DBG_ERROR("ScContentTree::InsertContent mit falschem Typ");
289cdf0e10cSrcweir         return;
290cdf0e10cSrcweir     }
291cdf0e10cSrcweir 
292cdf0e10cSrcweir     SvLBoxEntry* pParent = pRootNodes[nType];
293cdf0e10cSrcweir     if (pParent)
294cdf0e10cSrcweir         InsertEntry( rValue, pParent );
295cdf0e10cSrcweir     else
296cdf0e10cSrcweir     {
297cdf0e10cSrcweir         DBG_ERROR("InsertContent ohne Parent");
298cdf0e10cSrcweir     }
299cdf0e10cSrcweir }
300cdf0e10cSrcweir 
301cdf0e10cSrcweir void ScContentTree::GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvLBoxEntry* pEntry ) const
302cdf0e10cSrcweir {
303cdf0e10cSrcweir     rnRootIndex = SC_CONTENT_ROOT;
304cdf0e10cSrcweir     rnChildIndex = SC_CONTENT_NOCHILD;
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     if( !pEntry )
307cdf0e10cSrcweir         return;
308cdf0e10cSrcweir 
309cdf0e10cSrcweir     SvLBoxEntry* pParent = GetParent( pEntry );
310cdf0e10cSrcweir     bool bFound = false;
311cdf0e10cSrcweir     for( sal_uInt16 nRoot = 1; !bFound && (nRoot < SC_CONTENT_COUNT); ++nRoot )
312cdf0e10cSrcweir     {
313cdf0e10cSrcweir         if( pEntry == pRootNodes[ nRoot ] )
314cdf0e10cSrcweir         {
315cdf0e10cSrcweir             rnRootIndex = nRoot;
316cdf0e10cSrcweir             rnChildIndex = ~0UL;
317cdf0e10cSrcweir             bFound = true;
318cdf0e10cSrcweir         }
319cdf0e10cSrcweir         else if( pParent && (pParent == pRootNodes[ nRoot ]) )
320cdf0e10cSrcweir         {
321cdf0e10cSrcweir             rnRootIndex = nRoot;
322cdf0e10cSrcweir 
323cdf0e10cSrcweir             // search the entry in all child entries of the parent
324cdf0e10cSrcweir             sal_uLong nEntry = 0;
325cdf0e10cSrcweir             SvLBoxEntry* pIterEntry = FirstChild( pParent );
326cdf0e10cSrcweir             while( !bFound && pIterEntry )
327cdf0e10cSrcweir             {
328cdf0e10cSrcweir                 if ( pEntry == pIterEntry )
329cdf0e10cSrcweir                 {
330cdf0e10cSrcweir                     rnChildIndex = nEntry;
331cdf0e10cSrcweir                     bFound = true;  // exit the while loop
332cdf0e10cSrcweir                 }
333cdf0e10cSrcweir                 pIterEntry = NextSibling( pIterEntry );
334cdf0e10cSrcweir                 ++nEntry;
335cdf0e10cSrcweir             }
336cdf0e10cSrcweir 
337cdf0e10cSrcweir             bFound = true;  // exit the for loop
338cdf0e10cSrcweir         }
339cdf0e10cSrcweir     }
340cdf0e10cSrcweir }
341cdf0e10cSrcweir 
342cdf0e10cSrcweir sal_uLong ScContentTree::GetChildIndex( SvLBoxEntry* pEntry ) const
343cdf0e10cSrcweir {
344cdf0e10cSrcweir     sal_uInt16 nRoot;
345cdf0e10cSrcweir     sal_uLong nChild;
346cdf0e10cSrcweir     GetEntryIndexes( nRoot, nChild, pEntry );
347cdf0e10cSrcweir     return nChild;
348cdf0e10cSrcweir }
349cdf0e10cSrcweir 
350cdf0e10cSrcweir String lcl_GetDBAreaRange( ScDocument* pDoc, const String& rDBName )
351cdf0e10cSrcweir {
352cdf0e10cSrcweir     String aRet;
353cdf0e10cSrcweir     if (pDoc)
354cdf0e10cSrcweir     {
355cdf0e10cSrcweir         ScDBCollection* pDbNames = pDoc->GetDBCollection();
356cdf0e10cSrcweir         sal_uInt16 nCount = pDbNames->GetCount();
357cdf0e10cSrcweir         for ( sal_uInt16 i=0; i<nCount; i++ )
358cdf0e10cSrcweir         {
359cdf0e10cSrcweir             ScDBData* pData = (*pDbNames)[i];
360cdf0e10cSrcweir             if ( pData->GetName() == rDBName )
361cdf0e10cSrcweir             {
362cdf0e10cSrcweir                 ScRange aRange;
363cdf0e10cSrcweir                 pData->GetArea(aRange);
364cdf0e10cSrcweir                 aRange.Format( aRet, SCR_ABS_3D, pDoc );
365cdf0e10cSrcweir                 break;
366cdf0e10cSrcweir             }
367cdf0e10cSrcweir         }
368cdf0e10cSrcweir     }
369cdf0e10cSrcweir     return aRet;
370cdf0e10cSrcweir }
371cdf0e10cSrcweir 
372cdf0e10cSrcweir IMPL_LINK( ScContentTree, ContentDoubleClickHdl, ScContentTree *, EMPTYARG )
373cdf0e10cSrcweir {
374cdf0e10cSrcweir     sal_uInt16 nType;
375cdf0e10cSrcweir     sal_uLong nChild;
376cdf0e10cSrcweir     SvLBoxEntry* pEntry = GetCurEntry();
377cdf0e10cSrcweir     GetEntryIndexes( nType, nChild, pEntry );
378cdf0e10cSrcweir 
379cdf0e10cSrcweir     if( pEntry && (nType != SC_CONTENT_ROOT) && (nChild != SC_CONTENT_NOCHILD) )
380cdf0e10cSrcweir     {
381cdf0e10cSrcweir         if ( bHiddenDoc )
382cdf0e10cSrcweir             return 0;               //! spaeter...
383cdf0e10cSrcweir 
384cdf0e10cSrcweir         String aText( GetEntryText( pEntry ) );
385cdf0e10cSrcweir 
386cdf0e10cSrcweir         if ( aManualDoc.Len() )
387cdf0e10cSrcweir             pParentWindow->SetCurrentDoc( aManualDoc );
388cdf0e10cSrcweir 
389cdf0e10cSrcweir         switch( nType )
390cdf0e10cSrcweir         {
391cdf0e10cSrcweir             case SC_CONTENT_TABLE:
392cdf0e10cSrcweir                 pParentWindow->SetCurrentTableStr( aText );
393cdf0e10cSrcweir             break;
394cdf0e10cSrcweir 
395cdf0e10cSrcweir             case SC_CONTENT_RANGENAME:
396cdf0e10cSrcweir                 pParentWindow->SetCurrentCellStr( aText );
397cdf0e10cSrcweir             break;
398cdf0e10cSrcweir 
399cdf0e10cSrcweir             case SC_CONTENT_DBAREA:
400cdf0e10cSrcweir             {
401cdf0e10cSrcweir                 //  #47905# Wenn gleiche Bereichs- und DB-Namen existieren, wird
402cdf0e10cSrcweir                 //  bei SID_CURRENTCELL der Bereichsname genommen.
403cdf0e10cSrcweir                 //  DB-Bereiche darum direkt ueber die Adresse anspringen.
404cdf0e10cSrcweir 
405cdf0e10cSrcweir                 String aRangeStr = lcl_GetDBAreaRange( GetSourceDocument(), aText );
406cdf0e10cSrcweir                 if (aRangeStr.Len())
407cdf0e10cSrcweir                     pParentWindow->SetCurrentCellStr( aRangeStr );
408cdf0e10cSrcweir             }
409cdf0e10cSrcweir             break;
410cdf0e10cSrcweir 
411cdf0e10cSrcweir             case SC_CONTENT_OLEOBJECT:
412cdf0e10cSrcweir             case SC_CONTENT_GRAPHIC:
413cdf0e10cSrcweir             case SC_CONTENT_DRAWING:
414cdf0e10cSrcweir                 pParentWindow->SetCurrentObject( aText );
415cdf0e10cSrcweir             break;
416cdf0e10cSrcweir 
417cdf0e10cSrcweir             case SC_CONTENT_NOTE:
418cdf0e10cSrcweir             {
419cdf0e10cSrcweir                 ScAddress aPos = GetNotePos( nChild );
420cdf0e10cSrcweir                 pParentWindow->SetCurrentTable( aPos.Tab() );
421cdf0e10cSrcweir                 pParentWindow->SetCurrentCell( aPos.Col(), aPos.Row() );
422cdf0e10cSrcweir             }
423cdf0e10cSrcweir             break;
424cdf0e10cSrcweir 
425cdf0e10cSrcweir             case SC_CONTENT_AREALINK:
426cdf0e10cSrcweir             {
427cdf0e10cSrcweir                 const ScAreaLink* pLink = GetLink( nChild );
428cdf0e10cSrcweir                 if( pLink )
429cdf0e10cSrcweir                 {
430cdf0e10cSrcweir                     ScRange aRange = pLink->GetDestArea();
431cdf0e10cSrcweir                     String aRangeStr;
432cdf0e10cSrcweir                     ScDocument* pSrcDoc = GetSourceDocument();
433cdf0e10cSrcweir                     aRange.Format( aRangeStr, SCR_ABS_3D, pSrcDoc, pSrcDoc->GetAddressConvention() );
434cdf0e10cSrcweir                     pParentWindow->SetCurrentCellStr( aRangeStr );
435cdf0e10cSrcweir                 }
436cdf0e10cSrcweir             }
437cdf0e10cSrcweir             break;
438cdf0e10cSrcweir         }
439cdf0e10cSrcweir 
440cdf0e10cSrcweir         ScNavigatorDlg::ReleaseFocus();     // set focus into document
441cdf0e10cSrcweir     }
442cdf0e10cSrcweir 
443cdf0e10cSrcweir     return 0;
444cdf0e10cSrcweir }
445cdf0e10cSrcweir 
446cdf0e10cSrcweir void ScContentTree::MouseButtonDown( const MouseEvent& rMEvt )
447cdf0e10cSrcweir {
448cdf0e10cSrcweir     SvTreeListBox::MouseButtonDown( rMEvt );
449cdf0e10cSrcweir     StoreSettings();
450cdf0e10cSrcweir }
451cdf0e10cSrcweir 
452cdf0e10cSrcweir void ScContentTree::KeyInput( const KeyEvent& rKEvt )
453cdf0e10cSrcweir {
454cdf0e10cSrcweir     sal_Bool bUsed = sal_False;
455cdf0e10cSrcweir 
456cdf0e10cSrcweir     const KeyCode aCode = rKEvt.GetKeyCode();
457cdf0e10cSrcweir     if (aCode.GetCode() == KEY_RETURN)
458cdf0e10cSrcweir     {
459cdf0e10cSrcweir         switch (aCode.GetModifier())
460cdf0e10cSrcweir         {
461cdf0e10cSrcweir             case KEY_MOD1:
462cdf0e10cSrcweir                 ToggleRoot();       // toggle root mode (as in Writer)
463cdf0e10cSrcweir                 bUsed = sal_True;
464cdf0e10cSrcweir                 break;
465cdf0e10cSrcweir             case 0:
466cdf0e10cSrcweir             {
467cdf0e10cSrcweir                 SvLBoxEntry* pEntry = GetCurEntry();
468cdf0e10cSrcweir                 if( pEntry )
469cdf0e10cSrcweir                 {
470cdf0e10cSrcweir                     sal_uInt16 nType;
471cdf0e10cSrcweir                     sal_uLong nChild;
472cdf0e10cSrcweir                     GetEntryIndexes( nType, nChild, pEntry );
473cdf0e10cSrcweir 
474cdf0e10cSrcweir                     if( (nType != SC_CONTENT_ROOT) && (nChild == SC_CONTENT_NOCHILD) )
475cdf0e10cSrcweir                     {
476cdf0e10cSrcweir                         String aText( GetEntryText( pEntry ) );
477cdf0e10cSrcweir                         if ( IsExpanded( pEntry ) )
478cdf0e10cSrcweir                             Collapse( pEntry );
479cdf0e10cSrcweir                         else
480cdf0e10cSrcweir                             Expand( pEntry );
481cdf0e10cSrcweir                     }
482cdf0e10cSrcweir                     else
483cdf0e10cSrcweir                         ContentDoubleClickHdl(0);      // select content as if double clicked
484cdf0e10cSrcweir                 }
485cdf0e10cSrcweir 
486cdf0e10cSrcweir                 bUsed = sal_True;
487cdf0e10cSrcweir             }
488cdf0e10cSrcweir             break;
489cdf0e10cSrcweir         }
490cdf0e10cSrcweir     }
491*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
492*0deba7fbSSteve Yin     //Solution: Make KEY_SPACE has same function as DoubleClick
493*0deba7fbSSteve Yin     if ( bisInNavigatoeDlg )
494*0deba7fbSSteve Yin     {
495*0deba7fbSSteve Yin         if(aCode.GetCode() == KEY_SPACE )
496*0deba7fbSSteve Yin         {
497*0deba7fbSSteve Yin             bUsed = sal_True;
498*0deba7fbSSteve Yin             sal_uInt16 nType;
499*0deba7fbSSteve Yin             sal_uLong nChild;
500*0deba7fbSSteve Yin             SvLBoxEntry* pEntry = GetCurEntry();
501*0deba7fbSSteve Yin             GetEntryIndexes( nType, nChild, pEntry );
502*0deba7fbSSteve Yin             if( pEntry && (nType != SC_CONTENT_ROOT) && (nChild != SC_CONTENT_NOCHILD) )
503*0deba7fbSSteve Yin             {
504*0deba7fbSSteve Yin                 if ( bHiddenDoc )
505*0deba7fbSSteve Yin                     return ;                //! spaeter...
506*0deba7fbSSteve Yin                       String aText( GetEntryText( pEntry ) );
507*0deba7fbSSteve Yin                 sKeyString = aText;
508*0deba7fbSSteve Yin                 if ( aManualDoc.Len() )
509*0deba7fbSSteve Yin                     pParentWindow->SetCurrentDoc( aManualDoc );
510*0deba7fbSSteve Yin                 switch( nType )
511*0deba7fbSSteve Yin                 {
512*0deba7fbSSteve Yin                     case SC_CONTENT_OLEOBJECT:
513*0deba7fbSSteve Yin                     case SC_CONTENT_GRAPHIC:
514*0deba7fbSSteve Yin                     case SC_CONTENT_DRAWING:
515*0deba7fbSSteve Yin                     {
516*0deba7fbSSteve Yin                         Window* pWindow=(Window*)GetParent(pEntry);
517*0deba7fbSSteve Yin                         ScNavigatorDlg* pScNavigatorDlg = (ScNavigatorDlg*)pWindow;
518*0deba7fbSSteve Yin                         ScTabViewShell* pScTabViewShell = NULL;
519*0deba7fbSSteve Yin                         ScDrawView* pScDrawView = NULL;
520*0deba7fbSSteve Yin                         if (pScNavigatorDlg!=NULL)
521*0deba7fbSSteve Yin                               pScTabViewShell=pScNavigatorDlg->GetTabViewShell();
522*0deba7fbSSteve Yin                         if(pScTabViewShell !=NULL)
523*0deba7fbSSteve Yin                               pScDrawView =pScTabViewShell->GetViewData()->GetScDrawView();
524*0deba7fbSSteve Yin                         if(pScDrawView!=NULL)
525*0deba7fbSSteve Yin                          {
526*0deba7fbSSteve Yin                             pScDrawView->SelectCurrentViewObject(aText );
527*0deba7fbSSteve Yin                             sal_Bool bHasMakredObject = sal_False;
528*0deba7fbSSteve Yin                             SvLBoxEntry* pParent = pRootNodes[nType];
529*0deba7fbSSteve Yin                             SvLBoxEntry* pBeginEntry = NULL;
530*0deba7fbSSteve Yin                             if( pParent )
531*0deba7fbSSteve Yin                                 pBeginEntry = FirstChild(pParent);
532*0deba7fbSSteve Yin                             while( pBeginEntry )
533*0deba7fbSSteve Yin                             {
534*0deba7fbSSteve Yin                                 String aTempText( GetEntryText( pBeginEntry ) );
535*0deba7fbSSteve Yin                                  if( pScDrawView->GetObjectIsMarked( pScDrawView->GetObjectByName( aTempText ) ) )
536*0deba7fbSSteve Yin                                  {
537*0deba7fbSSteve Yin                                     bHasMakredObject = sal_True;
538*0deba7fbSSteve Yin                                     break;
539*0deba7fbSSteve Yin                                   }
540*0deba7fbSSteve Yin                                 pBeginEntry =  Next( pBeginEntry );
541*0deba7fbSSteve Yin                             }
542*0deba7fbSSteve Yin                             if(  !bHasMakredObject && pScTabViewShell)
543*0deba7fbSSteve Yin                                 pScTabViewShell->SetDrawShell(sal_False);
544*0deba7fbSSteve Yin                             ObjectFresh( nType,pEntry );
545*0deba7fbSSteve Yin                         }
546*0deba7fbSSteve Yin                     }
547*0deba7fbSSteve Yin                     break;
548*0deba7fbSSteve Yin                  }
549*0deba7fbSSteve Yin             }
550*0deba7fbSSteve Yin            }
551*0deba7fbSSteve Yin        }
552*0deba7fbSSteve Yin     //StoreSettings();
553*0deba7fbSSteve Yin     //-----IAccessibility2 Implementation 2009
554cdf0e10cSrcweir 
555cdf0e10cSrcweir     if( !bUsed )
556*0deba7fbSSteve Yin     //IAccessibility2 Implementation 2009-----
557*0deba7fbSSteve Yin     {
558*0deba7fbSSteve Yin         if(aCode.GetCode() == KEY_F5 )
559*0deba7fbSSteve Yin         {
560*0deba7fbSSteve Yin             StoreSettings();
561cdf0e10cSrcweir         SvTreeListBox::KeyInput(rKEvt);
562cdf0e10cSrcweir         }
563*0deba7fbSSteve Yin         else
564*0deba7fbSSteve Yin         {
565*0deba7fbSSteve Yin             SvTreeListBox::KeyInput(rKEvt);
566*0deba7fbSSteve Yin             StoreSettings();
567*0deba7fbSSteve Yin         }
568*0deba7fbSSteve Yin     }
569*0deba7fbSSteve Yin     //-----IAccessibility2 Implementation 2009
570*0deba7fbSSteve Yin }
571cdf0e10cSrcweir 
572cdf0e10cSrcweir //sal_Bool __EXPORT ScContentTree::Drop( const DropEvent& rEvt )
573cdf0e10cSrcweir //{
574cdf0e10cSrcweir //  return pParentWindow->Drop(rEvt);           // Drop auf Navigator
575cdf0e10cSrcweir //}
576cdf0e10cSrcweir 
577cdf0e10cSrcweir //sal_Bool __EXPORT ScContentTree::QueryDrop( DropEvent& rEvt )
578cdf0e10cSrcweir //{
579cdf0e10cSrcweir //  return pParentWindow->QueryDrop(rEvt);      // Drop auf Navigator
580cdf0e10cSrcweir //}
581cdf0e10cSrcweir 
582cdf0e10cSrcweir sal_Int8 ScContentTree::AcceptDrop( const AcceptDropEvent& /* rEvt */ )
583cdf0e10cSrcweir {
584cdf0e10cSrcweir     return DND_ACTION_NONE;
585cdf0e10cSrcweir }
586cdf0e10cSrcweir 
587cdf0e10cSrcweir sal_Int8 ScContentTree::ExecuteDrop( const ExecuteDropEvent& /* rEvt */ )
588cdf0e10cSrcweir {
589cdf0e10cSrcweir     return DND_ACTION_NONE;
590cdf0e10cSrcweir }
591cdf0e10cSrcweir 
592cdf0e10cSrcweir void ScContentTree::StartDrag( sal_Int8 /* nAction */, const Point& /* rPosPixel */ )
593cdf0e10cSrcweir {
594cdf0e10cSrcweir     DoDrag();
595cdf0e10cSrcweir }
596cdf0e10cSrcweir 
597cdf0e10cSrcweir void ScContentTree::DragFinished( sal_Int8 /* nAction */ )
598cdf0e10cSrcweir {
599cdf0e10cSrcweir }
600cdf0e10cSrcweir 
601cdf0e10cSrcweir void __EXPORT ScContentTree::Command( const CommandEvent& rCEvt )
602cdf0e10cSrcweir {
603cdf0e10cSrcweir     sal_Bool bDone = sal_False;
604cdf0e10cSrcweir 
605cdf0e10cSrcweir     switch ( rCEvt.GetCommand() )
606cdf0e10cSrcweir     {
607cdf0e10cSrcweir         case COMMAND_STARTDRAG:
608cdf0e10cSrcweir             //  Aus dem ExecuteDrag heraus kann der Navigator geloescht werden
609cdf0e10cSrcweir             //  (beim Umschalten auf einen anderen Dokument-Typ), das wuerde aber
610cdf0e10cSrcweir             //  den StarView MouseMove-Handler, der Command() aufruft, umbringen.
611cdf0e10cSrcweir             //  Deshalb Drag&Drop asynchron:
612cdf0e10cSrcweir 
613cdf0e10cSrcweir //          DoDrag();
614cdf0e10cSrcweir 
615cdf0e10cSrcweir             Application::PostUserEvent( STATIC_LINK( this, ScContentTree, ExecDragHdl ) );
616cdf0e10cSrcweir 
617cdf0e10cSrcweir             bDone = sal_True;
618cdf0e10cSrcweir             break;
619cdf0e10cSrcweir 
620cdf0e10cSrcweir         case COMMAND_CONTEXTMENU:
621cdf0e10cSrcweir             {
622cdf0e10cSrcweir                 //  Drag-Drop Modus
623cdf0e10cSrcweir 
624cdf0e10cSrcweir                 PopupMenu aPop;
625cdf0e10cSrcweir                 ScPopupMenu aDropMenu( ScResId( RID_POPUP_DROPMODE ) );
626cdf0e10cSrcweir                 aDropMenu.CheckItem( RID_DROPMODE_URL + pParentWindow->GetDropMode() );
627cdf0e10cSrcweir                 aPop.InsertItem( 1, pParentWindow->GetStrDragMode() );
628cdf0e10cSrcweir                 aPop.SetPopupMenu( 1, &aDropMenu );
629cdf0e10cSrcweir 
630cdf0e10cSrcweir                 //  angezeigtes Dokument
631cdf0e10cSrcweir 
632cdf0e10cSrcweir                 ScPopupMenu aDocMenu;
633cdf0e10cSrcweir                 aDocMenu.SetMenuFlags( aDocMenu.GetMenuFlags() | MENU_FLAG_NOAUTOMNEMONICS );
634cdf0e10cSrcweir                 sal_uInt16 i=0;
635cdf0e10cSrcweir                 sal_uInt16 nPos=0;
636cdf0e10cSrcweir                 //  geladene Dokumente
637cdf0e10cSrcweir                 ScDocShell* pCurrentSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() );
638cdf0e10cSrcweir                 SfxObjectShell* pSh = SfxObjectShell::GetFirst();
639cdf0e10cSrcweir                 while ( pSh )
640cdf0e10cSrcweir                 {
641cdf0e10cSrcweir                     if ( pSh->ISA(ScDocShell) )
642cdf0e10cSrcweir                     {
643cdf0e10cSrcweir                         String aName = pSh->GetTitle();
644cdf0e10cSrcweir                         String aEntry = aName;
645cdf0e10cSrcweir                         if ( pSh == pCurrentSh )
646cdf0e10cSrcweir                             aEntry += pParentWindow->aStrActive;
647cdf0e10cSrcweir                         else
648cdf0e10cSrcweir                             aEntry += pParentWindow->aStrNotActive;
649cdf0e10cSrcweir                         aDocMenu.InsertItem( ++i, aEntry );
650cdf0e10cSrcweir                         if ( !bHiddenDoc && aName == aManualDoc )
651cdf0e10cSrcweir                             nPos = i;
652cdf0e10cSrcweir                     }
653cdf0e10cSrcweir                     pSh = SfxObjectShell::GetNext( *pSh );
654cdf0e10cSrcweir                 }
655cdf0e10cSrcweir                 //  "aktives Fenster"
656cdf0e10cSrcweir                 aDocMenu.InsertItem( ++i, pParentWindow->aStrActiveWin );
657cdf0e10cSrcweir                 if (!bHiddenDoc && !aManualDoc.Len())
658cdf0e10cSrcweir                     nPos = i;
659cdf0e10cSrcweir                 //  verstecktes Dokument
660cdf0e10cSrcweir                 if ( aHiddenTitle.Len() )
661cdf0e10cSrcweir                 {
662cdf0e10cSrcweir                     String aEntry = aHiddenTitle;
663cdf0e10cSrcweir                     aEntry += pParentWindow->aStrHidden;
664cdf0e10cSrcweir                     aDocMenu.InsertItem( ++i, aEntry );
665cdf0e10cSrcweir                     if (bHiddenDoc)
666cdf0e10cSrcweir                         nPos = i;
667cdf0e10cSrcweir                 }
668cdf0e10cSrcweir                 aDocMenu.CheckItem( nPos );
669cdf0e10cSrcweir                 aPop.InsertItem( 2, pParentWindow->GetStrDisplay() );
670cdf0e10cSrcweir                 aPop.SetPopupMenu( 2, &aDocMenu );
671cdf0e10cSrcweir 
672cdf0e10cSrcweir                 //  ausfuehren
673cdf0e10cSrcweir 
674cdf0e10cSrcweir                 aPop.Execute( this, rCEvt.GetMousePosPixel() );
675cdf0e10cSrcweir 
676cdf0e10cSrcweir                 if ( aDropMenu.WasHit() )               //  Drag-Drop Modus
677cdf0e10cSrcweir                 {
678cdf0e10cSrcweir                     sal_uInt16 nId = aDropMenu.GetSelected();
679cdf0e10cSrcweir                     if ( nId >= RID_DROPMODE_URL && nId <= RID_DROPMODE_COPY )
680cdf0e10cSrcweir                         pParentWindow->SetDropMode( nId - RID_DROPMODE_URL );
681cdf0e10cSrcweir                 }
682cdf0e10cSrcweir                 else if ( aDocMenu.WasHit() )           //  angezeigtes Dokument
683cdf0e10cSrcweir                 {
684cdf0e10cSrcweir                     sal_uInt16 nId = aDocMenu.GetSelected();
685cdf0e10cSrcweir                     String aName = aDocMenu.GetItemText(nId);
686cdf0e10cSrcweir                     SelectDoc( aName );
687cdf0e10cSrcweir                 }
688cdf0e10cSrcweir             }
689cdf0e10cSrcweir             break;
690cdf0e10cSrcweir     }
691cdf0e10cSrcweir 
692cdf0e10cSrcweir     if (!bDone)
693cdf0e10cSrcweir         SvTreeListBox::Command(rCEvt);
694cdf0e10cSrcweir }
695cdf0e10cSrcweir 
696cdf0e10cSrcweir void __EXPORT ScContentTree::RequestHelp( const HelpEvent& rHEvt )
697cdf0e10cSrcweir {
698cdf0e10cSrcweir     sal_Bool bDone = sal_False;
699cdf0e10cSrcweir     if( rHEvt.GetMode() & HELPMODE_QUICK )
700cdf0e10cSrcweir     {
701cdf0e10cSrcweir         Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
702cdf0e10cSrcweir         SvLBoxEntry* pEntry = GetEntry( aPos );
703cdf0e10cSrcweir         if ( pEntry )
704cdf0e10cSrcweir         {
705cdf0e10cSrcweir             sal_Bool bRet = sal_False;
706cdf0e10cSrcweir             String aHelpText;
707cdf0e10cSrcweir             SvLBoxEntry* pParent = GetParent(pEntry);
708cdf0e10cSrcweir             if ( !pParent )                                 // Top-Level ?
709cdf0e10cSrcweir             {
710cdf0e10cSrcweir                 aHelpText = String::CreateFromInt32( GetChildCount(pEntry) );
711cdf0e10cSrcweir                 aHelpText += ' ';
712cdf0e10cSrcweir                 aHelpText += GetEntryText(pEntry);
713cdf0e10cSrcweir                 bRet = sal_True;
714cdf0e10cSrcweir             }
715cdf0e10cSrcweir             else if ( pParent == pRootNodes[SC_CONTENT_NOTE] )
716cdf0e10cSrcweir             {
717cdf0e10cSrcweir                 aHelpText = GetEntryText(pEntry);           // Notizen als Help-Text
718cdf0e10cSrcweir                 bRet = sal_True;
719cdf0e10cSrcweir             }
720cdf0e10cSrcweir             else if ( pParent == pRootNodes[SC_CONTENT_AREALINK] )
721cdf0e10cSrcweir             {
722cdf0e10cSrcweir                 sal_uLong nIndex = GetChildIndex(pEntry);
723cdf0e10cSrcweir                 if( nIndex != SC_CONTENT_NOCHILD )
724cdf0e10cSrcweir                 {
725cdf0e10cSrcweir                     const ScAreaLink* pLink = GetLink(nIndex);
726cdf0e10cSrcweir                     if (pLink)
727cdf0e10cSrcweir                     {
728cdf0e10cSrcweir                         aHelpText = pLink->GetFile();           // Source-Datei als Help-Text
729cdf0e10cSrcweir                         bRet = sal_True;
730cdf0e10cSrcweir                     }
731cdf0e10cSrcweir                 }
732cdf0e10cSrcweir             }
733cdf0e10cSrcweir 
734cdf0e10cSrcweir             if (bRet)
735cdf0e10cSrcweir             {
736cdf0e10cSrcweir                 SvLBoxTab* pTab;
737cdf0e10cSrcweir                 SvLBoxString* pItem = (SvLBoxString*)(GetItem( pEntry, aPos.X(), &pTab ));
738cdf0e10cSrcweir                 if( pItem )
739cdf0e10cSrcweir                 {
740cdf0e10cSrcweir                     aPos = GetEntryPosition( pEntry );
741cdf0e10cSrcweir                     aPos.X() = GetTabPos( pEntry, pTab );
742cdf0e10cSrcweir                     aPos = OutputToScreenPixel(aPos);
743cdf0e10cSrcweir                     Size aSize( pItem->GetSize( this, pEntry ) );
744cdf0e10cSrcweir 
745cdf0e10cSrcweir                     Rectangle aItemRect( aPos, aSize );
746cdf0e10cSrcweir                     Help::ShowQuickHelp( this, aItemRect, aHelpText );
747cdf0e10cSrcweir                     bDone = sal_True;
748cdf0e10cSrcweir                 }
749cdf0e10cSrcweir             }
750cdf0e10cSrcweir         }
751cdf0e10cSrcweir     }
752cdf0e10cSrcweir     if (!bDone)
753cdf0e10cSrcweir         Window::RequestHelp( rHEvt );
754cdf0e10cSrcweir }
755cdf0e10cSrcweir 
756cdf0e10cSrcweir ScDocument* ScContentTree::GetSourceDocument()
757cdf0e10cSrcweir {
758cdf0e10cSrcweir     if (bHiddenDoc)
759cdf0e10cSrcweir         return pHiddenDocument;
760cdf0e10cSrcweir     else
761cdf0e10cSrcweir     {
762cdf0e10cSrcweir         ScDocShell* pSh = GetManualOrCurrent();
763cdf0e10cSrcweir         if (pSh)
764cdf0e10cSrcweir             return pSh->GetDocument();
765cdf0e10cSrcweir 
766cdf0e10cSrcweir     }
767cdf0e10cSrcweir     return NULL;
768cdf0e10cSrcweir }
769cdf0e10cSrcweir 
770*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
771*0deba7fbSSteve Yin //Solution: move along and draw "*" sign .
772*0deba7fbSSteve Yin void ScContentTree::ObjectFresh( sal_uInt16 nType,SvLBoxEntry* pEntry )
773*0deba7fbSSteve Yin {
774*0deba7fbSSteve Yin     if ( bHiddenDoc && !pHiddenDocument )
775*0deba7fbSSteve Yin         return;     // anderes Dokument angezeigt
776*0deba7fbSSteve Yin       if(nType ==SC_CONTENT_GRAPHIC||nType ==SC_CONTENT_OLEOBJECT||nType ==SC_CONTENT_DRAWING)
777*0deba7fbSSteve Yin         {
778*0deba7fbSSteve Yin         SetUpdateMode(sal_False);
779*0deba7fbSSteve Yin         ClearType( nType );
780*0deba7fbSSteve Yin         /*sal_uInt16 nId = OBJ_GRAF;
781*0deba7fbSSteve Yin         switch( nType )
782*0deba7fbSSteve Yin         {
783*0deba7fbSSteve Yin             case SC_CONTENT_OLEOBJECT:
784*0deba7fbSSteve Yin                 nId = OBJ_OLE2;
785*0deba7fbSSteve Yin                 break;
786*0deba7fbSSteve Yin             case SC_CONTENT_DRAWING:
787*0deba7fbSSteve Yin                 nId = OBJ_GRUP;
788*0deba7fbSSteve Yin                 break;
789*0deba7fbSSteve Yin         }*/
790*0deba7fbSSteve Yin         GetDrawNames( nType/*, nId*/ );
791*0deba7fbSSteve Yin         if( !pEntry )
792*0deba7fbSSteve Yin             ApplySettings();
793*0deba7fbSSteve Yin         SetUpdateMode(sal_True);
794*0deba7fbSSteve Yin         if( pEntry )
795*0deba7fbSSteve Yin         {
796*0deba7fbSSteve Yin             SvLBoxEntry* pParent = pRootNodes[nType];
797*0deba7fbSSteve Yin             SvLBoxEntry* pBeginEntry = NULL;
798*0deba7fbSSteve Yin             SvLBoxEntry* pOldEntry = NULL;
799*0deba7fbSSteve Yin             if( pParent )
800*0deba7fbSSteve Yin                 pBeginEntry = FirstChild(pParent);
801*0deba7fbSSteve Yin             while( pBeginEntry )
802*0deba7fbSSteve Yin             {
803*0deba7fbSSteve Yin                 String aTempText( GetEntryText( pBeginEntry ) );
804*0deba7fbSSteve Yin                  if( aTempText ==  sKeyString )
805*0deba7fbSSteve Yin                  {
806*0deba7fbSSteve Yin                     pOldEntry = pBeginEntry;
807*0deba7fbSSteve Yin                     break;
808*0deba7fbSSteve Yin                   }
809*0deba7fbSSteve Yin                 pBeginEntry =  Next( pBeginEntry );
810*0deba7fbSSteve Yin             }
811*0deba7fbSSteve Yin             if( pOldEntry )
812*0deba7fbSSteve Yin             {
813*0deba7fbSSteve Yin                 Expand(pParent);
814*0deba7fbSSteve Yin                 Select( pOldEntry,sal_True);
815*0deba7fbSSteve Yin             }
816*0deba7fbSSteve Yin         }
817*0deba7fbSSteve Yin         }
818*0deba7fbSSteve Yin }
819*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009
820cdf0e10cSrcweir void ScContentTree::Refresh( sal_uInt16 nType )
821cdf0e10cSrcweir {
822cdf0e10cSrcweir     if ( bHiddenDoc && !pHiddenDocument )
823cdf0e10cSrcweir         return;                                 // anderes Dokument angezeigt
824cdf0e10cSrcweir 
825cdf0e10cSrcweir     //  wenn sich nichts geaendert hat, gleich abbrechen (gegen Geflacker)
826cdf0e10cSrcweir 
827cdf0e10cSrcweir     if ( nType == SC_CONTENT_NOTE )
828cdf0e10cSrcweir         if (!NoteStringsChanged())
829cdf0e10cSrcweir             return;
830cdf0e10cSrcweir     if ( nType == SC_CONTENT_GRAPHIC )
831cdf0e10cSrcweir         if (!DrawNamesChanged(SC_CONTENT_GRAPHIC))
832cdf0e10cSrcweir             return;
833cdf0e10cSrcweir     if ( nType == SC_CONTENT_OLEOBJECT )
834cdf0e10cSrcweir         if (!DrawNamesChanged(SC_CONTENT_OLEOBJECT))
835cdf0e10cSrcweir             return;
836cdf0e10cSrcweir     if ( nType == SC_CONTENT_DRAWING )
837cdf0e10cSrcweir         if (!DrawNamesChanged(SC_CONTENT_DRAWING))
838cdf0e10cSrcweir             return;
839cdf0e10cSrcweir 
840cdf0e10cSrcweir     SetUpdateMode(sal_False);
841cdf0e10cSrcweir 
842cdf0e10cSrcweir     ClearType( nType );
843cdf0e10cSrcweir 
844cdf0e10cSrcweir     if ( !nType || nType == SC_CONTENT_TABLE )
845cdf0e10cSrcweir         GetTableNames();
846cdf0e10cSrcweir     if ( !nType || nType == SC_CONTENT_RANGENAME )
847cdf0e10cSrcweir         GetAreaNames();
848cdf0e10cSrcweir     if ( !nType || nType == SC_CONTENT_DBAREA )
849cdf0e10cSrcweir         GetDbNames();
850cdf0e10cSrcweir     if ( !nType || nType == SC_CONTENT_GRAPHIC )
851cdf0e10cSrcweir         GetGraphicNames();
852cdf0e10cSrcweir     if ( !nType || nType == SC_CONTENT_OLEOBJECT )
853cdf0e10cSrcweir         GetOleNames();
854cdf0e10cSrcweir     if ( !nType || nType == SC_CONTENT_DRAWING )
855cdf0e10cSrcweir         GetDrawingNames();
856cdf0e10cSrcweir     if ( !nType || nType == SC_CONTENT_NOTE )
857cdf0e10cSrcweir         GetNoteStrings();
858cdf0e10cSrcweir     if ( !nType || nType == SC_CONTENT_AREALINK )
859cdf0e10cSrcweir         GetLinkNames();
860cdf0e10cSrcweir 
861cdf0e10cSrcweir     ApplySettings();
862cdf0e10cSrcweir     SetUpdateMode(sal_True);
863cdf0e10cSrcweir }
864cdf0e10cSrcweir 
865cdf0e10cSrcweir void ScContentTree::GetTableNames()
866cdf0e10cSrcweir {
867cdf0e10cSrcweir     if ( nRootType && nRootType != SC_CONTENT_TABLE )       // ausgeblendet ?
868cdf0e10cSrcweir         return;
869cdf0e10cSrcweir 
870cdf0e10cSrcweir     ScDocument* pDoc = GetSourceDocument();
871cdf0e10cSrcweir     if (!pDoc)
872cdf0e10cSrcweir         return;
873cdf0e10cSrcweir 
874cdf0e10cSrcweir     String aName;
875cdf0e10cSrcweir     SCTAB nCount = pDoc->GetTableCount();
876cdf0e10cSrcweir     for ( SCTAB i=0; i<nCount; i++ )
877cdf0e10cSrcweir     {
878cdf0e10cSrcweir         pDoc->GetName( i, aName );
879cdf0e10cSrcweir         InsertContent( SC_CONTENT_TABLE, aName );
880cdf0e10cSrcweir     }
881cdf0e10cSrcweir }
882cdf0e10cSrcweir 
883cdf0e10cSrcweir void ScContentTree::GetAreaNames()
884cdf0e10cSrcweir {
885cdf0e10cSrcweir     if ( nRootType && nRootType != SC_CONTENT_RANGENAME )       // ausgeblendet ?
886cdf0e10cSrcweir         return;
887cdf0e10cSrcweir 
888cdf0e10cSrcweir     ScDocument* pDoc = GetSourceDocument();
889cdf0e10cSrcweir     if (!pDoc)
890cdf0e10cSrcweir         return;
891cdf0e10cSrcweir 
892cdf0e10cSrcweir     ScRangeName* pRangeNames = pDoc->GetRangeName();
893cdf0e10cSrcweir     sal_uInt16 nCount = pRangeNames->GetCount();
894cdf0e10cSrcweir     if ( nCount > 0 )
895cdf0e10cSrcweir     {
896cdf0e10cSrcweir         sal_uInt16 nValidCount = 0;
897cdf0e10cSrcweir         ScRange aDummy;
898cdf0e10cSrcweir         sal_uInt16 i;
899cdf0e10cSrcweir         for ( i=0; i<nCount; i++ )
900cdf0e10cSrcweir         {
901cdf0e10cSrcweir             ScRangeData* pData = (*pRangeNames)[i];
902cdf0e10cSrcweir             if (pData->IsValidReference(aDummy))
903cdf0e10cSrcweir                 nValidCount++;
904cdf0e10cSrcweir         }
905cdf0e10cSrcweir         if ( nValidCount )
906cdf0e10cSrcweir         {
907cdf0e10cSrcweir             ScRangeData** ppSortArray = new ScRangeData* [ nValidCount ];
908cdf0e10cSrcweir             sal_uInt16 j;
909cdf0e10cSrcweir             for ( i=0, j=0; i<nCount; i++ )
910cdf0e10cSrcweir             {
911cdf0e10cSrcweir                 ScRangeData* pData = (*pRangeNames)[i];
912cdf0e10cSrcweir                 if (pData->IsValidReference(aDummy))
913cdf0e10cSrcweir                     ppSortArray[j++] = pData;
914cdf0e10cSrcweir             }
915cdf0e10cSrcweir #ifndef ICC
916cdf0e10cSrcweir             qsort( (void*)ppSortArray, nValidCount, sizeof(ScRangeData*),
917cdf0e10cSrcweir                 &ScRangeData_QsortNameCompare );
918cdf0e10cSrcweir #else
919cdf0e10cSrcweir             qsort( (void*)ppSortArray, nValidCount, sizeof(ScRangeData*),
920cdf0e10cSrcweir                 ICCQsortNameCompare );
921cdf0e10cSrcweir #endif
922cdf0e10cSrcweir             for ( j=0; j<nValidCount; j++ )
923cdf0e10cSrcweir                 InsertContent( SC_CONTENT_RANGENAME, ppSortArray[j]->GetName() );
924cdf0e10cSrcweir             delete [] ppSortArray;
925cdf0e10cSrcweir         }
926cdf0e10cSrcweir     }
927cdf0e10cSrcweir }
928cdf0e10cSrcweir 
929cdf0e10cSrcweir void ScContentTree::GetDbNames()
930cdf0e10cSrcweir {
931cdf0e10cSrcweir     if ( nRootType && nRootType != SC_CONTENT_DBAREA )      // ausgeblendet ?
932cdf0e10cSrcweir         return;
933cdf0e10cSrcweir 
934cdf0e10cSrcweir     ScDocument* pDoc = GetSourceDocument();
935cdf0e10cSrcweir     if (!pDoc)
936cdf0e10cSrcweir         return;
937cdf0e10cSrcweir 
938cdf0e10cSrcweir     ScDBCollection* pDbNames = pDoc->GetDBCollection();
939cdf0e10cSrcweir     sal_uInt16 nCount = pDbNames->GetCount();
940cdf0e10cSrcweir     if ( nCount > 0 )
941cdf0e10cSrcweir     {
942cdf0e10cSrcweir         String aStrNoName( ScGlobal::GetRscString(STR_DB_NONAME) );
943cdf0e10cSrcweir         for ( sal_uInt16 i=0; i<nCount; i++ )
944cdf0e10cSrcweir         {
945cdf0e10cSrcweir             ScDBData* pData = (*pDbNames)[i];
946cdf0e10cSrcweir             String aStrName = pData->GetName();
94757b4fa3cSWang Lei             //if ( aStrName != aStrNoName )
94857b4fa3cSWang Lei             if ( !pData->IsBuildin() )
949cdf0e10cSrcweir                 InsertContent( SC_CONTENT_DBAREA, aStrName );
950cdf0e10cSrcweir         }
951cdf0e10cSrcweir     }
952cdf0e10cSrcweir }
953cdf0e10cSrcweir 
954cdf0e10cSrcweir bool ScContentTree::IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier )  // static
955cdf0e10cSrcweir {
956cdf0e10cSrcweir     bool bRet = false;
957cdf0e10cSrcweir     switch ( nContentType )
958cdf0e10cSrcweir     {
959cdf0e10cSrcweir         case SC_CONTENT_GRAPHIC:
960cdf0e10cSrcweir             bRet = ( nObjIdentifier == OBJ_GRAF );
961cdf0e10cSrcweir             break;
962cdf0e10cSrcweir         case SC_CONTENT_OLEOBJECT:
963cdf0e10cSrcweir             bRet = ( nObjIdentifier == OBJ_OLE2 );
964cdf0e10cSrcweir             break;
965cdf0e10cSrcweir         case SC_CONTENT_DRAWING:
966cdf0e10cSrcweir             bRet = ( nObjIdentifier != OBJ_GRAF && nObjIdentifier != OBJ_OLE2 );    // everything else
967cdf0e10cSrcweir             break;
968cdf0e10cSrcweir         default:
969cdf0e10cSrcweir             DBG_ERROR("unknown content type");
970cdf0e10cSrcweir     }
971cdf0e10cSrcweir     return bRet;
972cdf0e10cSrcweir }
973cdf0e10cSrcweir 
974cdf0e10cSrcweir void ScContentTree::GetDrawNames( sal_uInt16 nType )
975cdf0e10cSrcweir {
976cdf0e10cSrcweir     if ( nRootType && nRootType != nType )              // ausgeblendet ?
977cdf0e10cSrcweir         return;
978cdf0e10cSrcweir 
979cdf0e10cSrcweir     ScDocument* pDoc = GetSourceDocument();
980cdf0e10cSrcweir     if (!pDoc)
981cdf0e10cSrcweir         return;
982cdf0e10cSrcweir 
983cdf0e10cSrcweir     // iterate in flat mode for groups
984cdf0e10cSrcweir     SdrIterMode eIter = ( nType == SC_CONTENT_DRAWING ) ? IM_FLAT : IM_DEEPNOGROUPS;
985cdf0e10cSrcweir 
986cdf0e10cSrcweir     ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
987cdf0e10cSrcweir     SfxObjectShell* pShell = pDoc->GetDocumentShell();
988cdf0e10cSrcweir     if (pDrawLayer && pShell)
989cdf0e10cSrcweir     {
990cdf0e10cSrcweir         SCTAB nTabCount = pDoc->GetTableCount();
991cdf0e10cSrcweir         for (SCTAB nTab=0; nTab<nTabCount; nTab++)
992cdf0e10cSrcweir         {
993cdf0e10cSrcweir             SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
994cdf0e10cSrcweir             DBG_ASSERT(pPage,"Page ?");
995cdf0e10cSrcweir             if (pPage)
996cdf0e10cSrcweir             {
997cdf0e10cSrcweir                 SdrObjListIter aIter( *pPage, eIter );
998cdf0e10cSrcweir                 SdrObject* pObject = aIter.Next();
999cdf0e10cSrcweir                 while (pObject)
1000cdf0e10cSrcweir                 {
1001cdf0e10cSrcweir                     if ( IsPartOfType( nType, pObject->GetObjIdentifier() ) )
1002cdf0e10cSrcweir                     {
1003cdf0e10cSrcweir                         String aName = ScDrawLayer::GetVisibleName( pObject );
1004cdf0e10cSrcweir                         if (aName.Len())
1005*0deba7fbSSteve Yin                         {
1006*0deba7fbSSteve Yin                             //IAccessibility2 Implementation 2009-----
1007*0deba7fbSSteve Yin                             //InsertContent( nType, aName );
1008*0deba7fbSSteve Yin                             if( bisInNavigatoeDlg )
1009*0deba7fbSSteve Yin                             {
1010*0deba7fbSSteve Yin                                 if (nType >= SC_CONTENT_COUNT)
1011*0deba7fbSSteve Yin                                 {
1012*0deba7fbSSteve Yin                                     DBG_ERROR("ScContentTree::InsertContent mit falschem Typ");
1013*0deba7fbSSteve Yin                                     return;
1014cdf0e10cSrcweir                     }
1015*0deba7fbSSteve Yin                                 SvLBoxEntry* pParent = pRootNodes[nType];
1016*0deba7fbSSteve Yin                                 if (pParent)
1017*0deba7fbSSteve Yin                                 {
1018*0deba7fbSSteve Yin                                     SvLBoxEntry* pChild=InsertEntry( aName, pParent );
1019*0deba7fbSSteve Yin                                     if(pChild)
1020*0deba7fbSSteve Yin                                             pChild->SetMarked( sal_False);
1021*0deba7fbSSteve Yin                                     Window* pWindow=NULL;
1022*0deba7fbSSteve Yin                                     ScTabViewShell* pScTabViewShell=NULL;
1023*0deba7fbSSteve Yin                                     ScDrawView* pScDrawView=NULL;
1024*0deba7fbSSteve Yin                                     ScNavigatorDlg* pScNavigatorDlg=NULL;
1025*0deba7fbSSteve Yin                                     if(pChild)
1026*0deba7fbSSteve Yin                                          pWindow=(Window*)GetParent(pChild);
1027*0deba7fbSSteve Yin                                     if(pWindow)
1028*0deba7fbSSteve Yin                                             pScNavigatorDlg = (ScNavigatorDlg*)pWindow;
1029*0deba7fbSSteve Yin                                     if (pScNavigatorDlg!=NULL)
1030*0deba7fbSSteve Yin                                           pScTabViewShell=pScNavigatorDlg->GetTabViewShell();
1031*0deba7fbSSteve Yin                                     if(pScTabViewShell !=NULL)
1032*0deba7fbSSteve Yin                                           pScDrawView =pScTabViewShell->GetViewData()->GetScDrawView();
1033*0deba7fbSSteve Yin                                     if(pScDrawView!=NULL)
1034*0deba7fbSSteve Yin                                      {
1035*0deba7fbSSteve Yin                                          sal_Bool bMarked =pScDrawView->GetObjectIsMarked(pObject);
1036*0deba7fbSSteve Yin                                          pChild->SetMarked( bMarked );
1037*0deba7fbSSteve Yin                                       }
1038*0deba7fbSSteve Yin                                 }//end if parent
1039*0deba7fbSSteve Yin                                 else
1040*0deba7fbSSteve Yin                                     DBG_ERROR("InsertContent ohne Parent");
1041*0deba7fbSSteve Yin                             }
1042*0deba7fbSSteve Yin                         }
1043*0deba7fbSSteve Yin                     }
1044*0deba7fbSSteve Yin                     //-----IAccessibility2 Implementation 2009
1045cdf0e10cSrcweir                     pObject = aIter.Next();
1046cdf0e10cSrcweir                 }
1047cdf0e10cSrcweir             }
1048cdf0e10cSrcweir         }
1049cdf0e10cSrcweir     }
1050cdf0e10cSrcweir }
1051cdf0e10cSrcweir 
1052cdf0e10cSrcweir void ScContentTree::GetGraphicNames()
1053cdf0e10cSrcweir {
1054cdf0e10cSrcweir     GetDrawNames( SC_CONTENT_GRAPHIC );
1055cdf0e10cSrcweir }
1056cdf0e10cSrcweir 
1057cdf0e10cSrcweir void ScContentTree::GetOleNames()
1058cdf0e10cSrcweir {
1059cdf0e10cSrcweir     GetDrawNames( SC_CONTENT_OLEOBJECT );
1060cdf0e10cSrcweir }
1061cdf0e10cSrcweir 
1062cdf0e10cSrcweir void ScContentTree::GetDrawingNames()
1063cdf0e10cSrcweir {
1064cdf0e10cSrcweir     GetDrawNames( SC_CONTENT_DRAWING );
1065cdf0e10cSrcweir }
1066cdf0e10cSrcweir 
1067cdf0e10cSrcweir void ScContentTree::GetLinkNames()
1068cdf0e10cSrcweir {
1069cdf0e10cSrcweir     if ( nRootType && nRootType != SC_CONTENT_AREALINK )                // ausgeblendet ?
1070cdf0e10cSrcweir         return;
1071cdf0e10cSrcweir 
1072cdf0e10cSrcweir     ScDocument* pDoc = GetSourceDocument();
1073cdf0e10cSrcweir     if (!pDoc)
1074cdf0e10cSrcweir         return;
1075cdf0e10cSrcweir 
1076cdf0e10cSrcweir     sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
1077cdf0e10cSrcweir     DBG_ASSERT(pLinkManager, "kein LinkManager am Dokument?");
1078cdf0e10cSrcweir     const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
1079cdf0e10cSrcweir     sal_uInt16 nCount = rLinks.Count();
1080cdf0e10cSrcweir     for (sal_uInt16 i=0; i<nCount; i++)
1081cdf0e10cSrcweir     {
1082cdf0e10cSrcweir         ::sfx2::SvBaseLink* pBase = *rLinks[i];
1083cdf0e10cSrcweir         if (pBase->ISA(ScAreaLink))
1084cdf0e10cSrcweir             InsertContent( SC_CONTENT_AREALINK, ((ScAreaLink*)pBase)->GetSource() );
1085cdf0e10cSrcweir 
1086cdf0e10cSrcweir             //  in der Liste die Namen der Quellbereiche
1087cdf0e10cSrcweir     }
1088cdf0e10cSrcweir }
1089cdf0e10cSrcweir 
1090cdf0e10cSrcweir const ScAreaLink* ScContentTree::GetLink( sal_uLong nIndex )
1091cdf0e10cSrcweir {
1092cdf0e10cSrcweir     ScDocument* pDoc = GetSourceDocument();
1093cdf0e10cSrcweir     if (!pDoc)
1094cdf0e10cSrcweir         return NULL;
1095cdf0e10cSrcweir 
1096cdf0e10cSrcweir     sal_uLong nFound = 0;
1097cdf0e10cSrcweir     sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
1098cdf0e10cSrcweir     DBG_ASSERT(pLinkManager, "kein LinkManager am Dokument?");
1099cdf0e10cSrcweir     const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
1100cdf0e10cSrcweir     sal_uInt16 nCount = rLinks.Count();
1101cdf0e10cSrcweir     for (sal_uInt16 i=0; i<nCount; i++)
1102cdf0e10cSrcweir     {
1103cdf0e10cSrcweir         ::sfx2::SvBaseLink* pBase = *rLinks[i];
1104cdf0e10cSrcweir         if (pBase->ISA(ScAreaLink))
1105cdf0e10cSrcweir         {
1106cdf0e10cSrcweir             if (nFound == nIndex)
1107cdf0e10cSrcweir                 return (const ScAreaLink*) pBase;
1108cdf0e10cSrcweir             ++nFound;
1109cdf0e10cSrcweir         }
1110cdf0e10cSrcweir     }
1111cdf0e10cSrcweir 
1112cdf0e10cSrcweir     DBG_ERROR("Link nicht gefunden");
1113cdf0e10cSrcweir     return NULL;
1114cdf0e10cSrcweir }
1115cdf0e10cSrcweir 
1116cdf0e10cSrcweir String lcl_NoteString( const ScPostIt& rNote )
1117cdf0e10cSrcweir {
1118cdf0e10cSrcweir     String aText = rNote.GetText();
1119cdf0e10cSrcweir     xub_StrLen nAt;
1120cdf0e10cSrcweir     while ( (nAt = aText.Search( '\n' )) != STRING_NOTFOUND )
1121cdf0e10cSrcweir         aText.SetChar( nAt, ' ' );
1122cdf0e10cSrcweir     return aText;
1123cdf0e10cSrcweir }
1124cdf0e10cSrcweir 
1125cdf0e10cSrcweir void ScContentTree::GetNoteStrings()
1126cdf0e10cSrcweir {
1127cdf0e10cSrcweir     if ( nRootType && nRootType != SC_CONTENT_NOTE )        // ausgeblendet ?
1128cdf0e10cSrcweir         return;
1129cdf0e10cSrcweir 
1130cdf0e10cSrcweir     ScDocument* pDoc = GetSourceDocument();
1131cdf0e10cSrcweir     if (!pDoc)
1132cdf0e10cSrcweir         return;
1133cdf0e10cSrcweir 
1134cdf0e10cSrcweir     SCTAB nTabCount = pDoc->GetTableCount();
1135cdf0e10cSrcweir     for (SCTAB nTab=0; nTab<nTabCount; nTab++)
1136cdf0e10cSrcweir     {
1137cdf0e10cSrcweir         ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab );
1138cdf0e10cSrcweir         for( ScBaseCell* pCell = aIter.GetFirst(); pCell; pCell = aIter.GetNext() )
1139cdf0e10cSrcweir             if( const ScPostIt* pNote = pCell->GetNote() )
1140cdf0e10cSrcweir                 InsertContent( SC_CONTENT_NOTE, lcl_NoteString( *pNote ) );
1141cdf0e10cSrcweir     }
1142cdf0e10cSrcweir }
1143cdf0e10cSrcweir 
1144cdf0e10cSrcweir ScAddress ScContentTree::GetNotePos( sal_uLong nIndex )
1145cdf0e10cSrcweir {
1146cdf0e10cSrcweir     ScDocument* pDoc = GetSourceDocument();
1147cdf0e10cSrcweir     if (!pDoc)
1148cdf0e10cSrcweir         return ScAddress();
1149cdf0e10cSrcweir 
1150cdf0e10cSrcweir     sal_uLong nFound = 0;
1151cdf0e10cSrcweir     SCTAB nTabCount = pDoc->GetTableCount();
1152cdf0e10cSrcweir     for (SCTAB nTab=0; nTab<nTabCount; nTab++)
1153cdf0e10cSrcweir     {
1154cdf0e10cSrcweir         ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab );
1155cdf0e10cSrcweir         ScBaseCell* pCell = aIter.GetFirst();
1156cdf0e10cSrcweir         while (pCell)
1157cdf0e10cSrcweir         {
1158cdf0e10cSrcweir             if( pCell->HasNote() )
1159cdf0e10cSrcweir             {
1160cdf0e10cSrcweir                 if (nFound == nIndex)
1161cdf0e10cSrcweir                     return ScAddress( aIter.GetCol(), aIter.GetRow(), nTab );   // gefunden
1162cdf0e10cSrcweir                 ++nFound;
1163cdf0e10cSrcweir             }
1164cdf0e10cSrcweir             pCell = aIter.GetNext();
1165cdf0e10cSrcweir         }
1166cdf0e10cSrcweir     }
1167cdf0e10cSrcweir 
1168cdf0e10cSrcweir     DBG_ERROR("Notiz nicht gefunden");
1169cdf0e10cSrcweir     return ScAddress();
1170cdf0e10cSrcweir }
1171cdf0e10cSrcweir 
1172cdf0e10cSrcweir sal_Bool ScContentTree::NoteStringsChanged()
1173cdf0e10cSrcweir {
1174cdf0e10cSrcweir     ScDocument* pDoc = GetSourceDocument();
1175cdf0e10cSrcweir     if (!pDoc)
1176cdf0e10cSrcweir         return sal_False;
1177cdf0e10cSrcweir 
1178cdf0e10cSrcweir     SvLBoxEntry* pParent = pRootNodes[SC_CONTENT_NOTE];
1179cdf0e10cSrcweir     if (!pParent)
1180cdf0e10cSrcweir         return sal_False;
1181cdf0e10cSrcweir 
1182cdf0e10cSrcweir     SvLBoxEntry* pEntry = FirstChild( pParent );
1183cdf0e10cSrcweir 
1184cdf0e10cSrcweir     sal_Bool bEqual = sal_True;
1185cdf0e10cSrcweir     SCTAB nTabCount = pDoc->GetTableCount();
1186cdf0e10cSrcweir     for (SCTAB nTab=0; nTab<nTabCount && bEqual; nTab++)
1187cdf0e10cSrcweir     {
1188cdf0e10cSrcweir         ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab );
1189cdf0e10cSrcweir         ScBaseCell* pCell = aIter.GetFirst();
1190cdf0e10cSrcweir         while (pCell && bEqual)
1191cdf0e10cSrcweir         {
1192cdf0e10cSrcweir             if( const ScPostIt* pNote = pCell->GetNote() )
1193cdf0e10cSrcweir             {
1194cdf0e10cSrcweir                 if ( !pEntry )
1195cdf0e10cSrcweir                     bEqual = sal_False;
1196cdf0e10cSrcweir                 else
1197cdf0e10cSrcweir                 {
1198cdf0e10cSrcweir                     if ( lcl_NoteString( *pNote ) != GetEntryText(pEntry) )
1199cdf0e10cSrcweir                         bEqual = sal_False;
1200cdf0e10cSrcweir 
1201cdf0e10cSrcweir                     pEntry = NextSibling( pEntry );
1202cdf0e10cSrcweir                 }
1203cdf0e10cSrcweir             }
1204cdf0e10cSrcweir             pCell = aIter.GetNext();
1205cdf0e10cSrcweir         }
1206cdf0e10cSrcweir     }
1207cdf0e10cSrcweir 
1208cdf0e10cSrcweir     if ( pEntry )
1209cdf0e10cSrcweir         bEqual = sal_False;             // kommt noch was
1210cdf0e10cSrcweir 
1211cdf0e10cSrcweir     return !bEqual;
1212cdf0e10cSrcweir }
1213cdf0e10cSrcweir 
1214cdf0e10cSrcweir sal_Bool ScContentTree::DrawNamesChanged( sal_uInt16 nType )
1215cdf0e10cSrcweir {
1216cdf0e10cSrcweir     ScDocument* pDoc = GetSourceDocument();
1217cdf0e10cSrcweir     if (!pDoc)
1218cdf0e10cSrcweir         return sal_False;
1219cdf0e10cSrcweir 
1220cdf0e10cSrcweir     SvLBoxEntry* pParent = pRootNodes[nType];
1221cdf0e10cSrcweir     if (!pParent)
1222cdf0e10cSrcweir         return sal_False;
1223cdf0e10cSrcweir 
1224cdf0e10cSrcweir     SvLBoxEntry* pEntry = FirstChild( pParent );
1225cdf0e10cSrcweir 
1226cdf0e10cSrcweir     // iterate in flat mode for groups
1227cdf0e10cSrcweir     SdrIterMode eIter = ( nType == SC_CONTENT_DRAWING ) ? IM_FLAT : IM_DEEPNOGROUPS;
1228cdf0e10cSrcweir 
1229cdf0e10cSrcweir     sal_Bool bEqual = sal_True;
1230cdf0e10cSrcweir     ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
1231cdf0e10cSrcweir     SfxObjectShell* pShell = pDoc->GetDocumentShell();
1232cdf0e10cSrcweir     if (pDrawLayer && pShell)
1233cdf0e10cSrcweir     {
1234cdf0e10cSrcweir         SCTAB nTabCount = pDoc->GetTableCount();
1235cdf0e10cSrcweir         for (SCTAB nTab=0; nTab<nTabCount && bEqual; nTab++)
1236cdf0e10cSrcweir         {
1237cdf0e10cSrcweir             SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
1238cdf0e10cSrcweir             DBG_ASSERT(pPage,"Page ?");
1239cdf0e10cSrcweir             if (pPage)
1240cdf0e10cSrcweir             {
1241cdf0e10cSrcweir                 SdrObjListIter aIter( *pPage, eIter );
1242cdf0e10cSrcweir                 SdrObject* pObject = aIter.Next();
1243cdf0e10cSrcweir                 while (pObject && bEqual)
1244cdf0e10cSrcweir                 {
1245cdf0e10cSrcweir                     if ( IsPartOfType( nType, pObject->GetObjIdentifier() ) )
1246cdf0e10cSrcweir                     {
1247cdf0e10cSrcweir                         if ( !pEntry )
1248cdf0e10cSrcweir                             bEqual = sal_False;
1249cdf0e10cSrcweir                         else
1250cdf0e10cSrcweir                         {
1251cdf0e10cSrcweir                             if ( ScDrawLayer::GetVisibleName( pObject ) != GetEntryText(pEntry) )
1252cdf0e10cSrcweir                                 bEqual = sal_False;
1253cdf0e10cSrcweir 
1254cdf0e10cSrcweir                             pEntry = NextSibling( pEntry );
1255cdf0e10cSrcweir                         }
1256cdf0e10cSrcweir                     }
1257cdf0e10cSrcweir                     pObject = aIter.Next();
1258cdf0e10cSrcweir                 }
1259cdf0e10cSrcweir             }
1260cdf0e10cSrcweir         }
1261cdf0e10cSrcweir     }
1262cdf0e10cSrcweir 
1263cdf0e10cSrcweir     if ( pEntry )
1264cdf0e10cSrcweir         bEqual = sal_False;             // kommt noch was
1265cdf0e10cSrcweir 
1266cdf0e10cSrcweir     return !bEqual;
1267cdf0e10cSrcweir }
1268cdf0e10cSrcweir 
1269cdf0e10cSrcweir sal_Bool lcl_GetRange( ScDocument* pDoc, sal_uInt16 nType, const String& rName, ScRange& rRange )
1270cdf0e10cSrcweir {
1271cdf0e10cSrcweir     sal_Bool bFound = sal_False;
1272cdf0e10cSrcweir     sal_uInt16 nPos;
1273cdf0e10cSrcweir 
1274cdf0e10cSrcweir     if ( nType == SC_CONTENT_RANGENAME )
1275cdf0e10cSrcweir     {
1276cdf0e10cSrcweir         ScRangeName* pList = pDoc->GetRangeName();
1277cdf0e10cSrcweir         if (pList)
1278cdf0e10cSrcweir             if (pList->SearchName( rName, nPos ))
1279cdf0e10cSrcweir                 if ( (*pList)[nPos]->IsValidReference( rRange ) )
1280cdf0e10cSrcweir                     bFound = sal_True;
1281cdf0e10cSrcweir     }
1282cdf0e10cSrcweir     else if ( nType == SC_CONTENT_DBAREA )
1283cdf0e10cSrcweir     {
1284cdf0e10cSrcweir         ScDBCollection* pList = pDoc->GetDBCollection();
1285cdf0e10cSrcweir         if (pList)
1286cdf0e10cSrcweir             if (pList->SearchName( rName, nPos ))
1287cdf0e10cSrcweir             {
1288cdf0e10cSrcweir                 SCTAB nTab;
1289cdf0e10cSrcweir                 SCCOL nCol1, nCol2;
1290cdf0e10cSrcweir                 SCROW nRow1, nRow2;
1291cdf0e10cSrcweir                 (*pList)[nPos]->GetArea(nTab,nCol1,nRow1,nCol2,nRow2);
1292cdf0e10cSrcweir                 rRange = ScRange( nCol1,nRow1,nTab, nCol2,nRow2,nTab );
1293cdf0e10cSrcweir                 bFound = sal_True;
1294cdf0e10cSrcweir             }
1295cdf0e10cSrcweir     }
1296cdf0e10cSrcweir 
1297cdf0e10cSrcweir     return bFound;
1298cdf0e10cSrcweir }
1299cdf0e10cSrcweir 
1300cdf0e10cSrcweir void lcl_DoDragObject( ScDocShell* pSrcShell, const String& rName, sal_uInt16 nType, Window* pWin )
1301cdf0e10cSrcweir {
1302cdf0e10cSrcweir     ScDocument* pSrcDoc = pSrcShell->GetDocument();
1303cdf0e10cSrcweir     ScDrawLayer* pModel = pSrcDoc->GetDrawLayer();
1304cdf0e10cSrcweir     if (pModel)
1305cdf0e10cSrcweir     {
1306cdf0e10cSrcweir         sal_Bool bOle = ( nType == SC_CONTENT_OLEOBJECT );
1307cdf0e10cSrcweir         sal_Bool bGraf = ( nType == SC_CONTENT_GRAPHIC );
1308cdf0e10cSrcweir         sal_uInt16 nDrawId = sal::static_int_cast<sal_uInt16>( bOle ? OBJ_OLE2 : ( bGraf ? OBJ_GRAF : OBJ_GRUP ) );
1309cdf0e10cSrcweir         SCTAB nTab = 0;
1310cdf0e10cSrcweir         SdrObject* pObject = pModel->GetNamedObject( rName, nDrawId, nTab );
1311cdf0e10cSrcweir         if (pObject)
1312cdf0e10cSrcweir         {
1313cdf0e10cSrcweir             SdrView aEditView( pModel );
1314cdf0e10cSrcweir             aEditView.ShowSdrPage(aEditView.GetModel()->GetPage(nTab));
1315cdf0e10cSrcweir             SdrPageView* pPV = aEditView.GetSdrPageView();
1316cdf0e10cSrcweir             aEditView.MarkObj(pObject, pPV);
1317cdf0e10cSrcweir 
1318cdf0e10cSrcweir             SdrModel* pDragModel = aEditView.GetAllMarkedModel();
1319cdf0e10cSrcweir 
1320cdf0e10cSrcweir             TransferableObjectDescriptor aObjDesc;
1321cdf0e10cSrcweir             pSrcShell->FillTransferableObjectDescriptor( aObjDesc );
1322cdf0e10cSrcweir             aObjDesc.maDisplayName = pSrcShell->GetMedium()->GetURLObject().GetURLNoPass();
1323cdf0e10cSrcweir             // maSize is set in ScDrawTransferObj ctor
1324cdf0e10cSrcweir 
1325cdf0e10cSrcweir             ScDrawTransferObj* pTransferObj = new ScDrawTransferObj( pDragModel, pSrcShell, aObjDesc );
1326cdf0e10cSrcweir             uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
1327cdf0e10cSrcweir 
1328cdf0e10cSrcweir             pTransferObj->SetDragSourceObj( pObject, nTab );
1329cdf0e10cSrcweir             pTransferObj->SetDragSourceFlags( SC_DROP_NAVIGATOR );
1330cdf0e10cSrcweir 
1331cdf0e10cSrcweir             SC_MOD()->SetDragObject( NULL, pTransferObj );
1332cdf0e10cSrcweir             pWin->ReleaseMouse();
1333cdf0e10cSrcweir             pTransferObj->StartDrag( pWin, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
1334cdf0e10cSrcweir         }
1335cdf0e10cSrcweir     }
1336cdf0e10cSrcweir }
1337cdf0e10cSrcweir 
1338cdf0e10cSrcweir void lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, sal_uInt16 nFlags, Window* pWin )
1339cdf0e10cSrcweir {
1340cdf0e10cSrcweir     ScMarkData aMark;
1341cdf0e10cSrcweir     aMark.SelectTable( rRange.aStart.Tab(), sal_True );
1342cdf0e10cSrcweir     aMark.SetMarkArea( rRange );
1343cdf0e10cSrcweir 
1344cdf0e10cSrcweir     ScDocument* pSrcDoc = pSrcShell->GetDocument();
1345cdf0e10cSrcweir     if ( !pSrcDoc->HasSelectedBlockMatrixFragment( rRange.aStart.Col(), rRange.aStart.Row(),
1346cdf0e10cSrcweir                                                    rRange.aEnd.Col(),   rRange.aEnd.Row(),
1347cdf0e10cSrcweir                                                    aMark ) )
1348cdf0e10cSrcweir     {
1349cdf0e10cSrcweir         ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
1350cdf0e10cSrcweir         ScClipParam aClipParam(rRange, false);
1351cdf0e10cSrcweir         pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark);
1352cdf0e10cSrcweir         // pClipDoc->ExtendMerge( rRange, sal_True );
1353cdf0e10cSrcweir 
1354cdf0e10cSrcweir         TransferableObjectDescriptor aObjDesc;
1355cdf0e10cSrcweir         pSrcShell->FillTransferableObjectDescriptor( aObjDesc );
1356cdf0e10cSrcweir         aObjDesc.maDisplayName = pSrcShell->GetMedium()->GetURLObject().GetURLNoPass();
1357cdf0e10cSrcweir         // maSize is set in ScTransferObj ctor
1358cdf0e10cSrcweir 
1359cdf0e10cSrcweir         ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
1360cdf0e10cSrcweir         uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
1361cdf0e10cSrcweir 
1362cdf0e10cSrcweir         pTransferObj->SetDragSource( pSrcShell, aMark );
1363cdf0e10cSrcweir         pTransferObj->SetDragSourceFlags( nFlags );
1364cdf0e10cSrcweir 
1365cdf0e10cSrcweir         SC_MOD()->SetDragObject( pTransferObj, NULL );      // for internal D&D
1366cdf0e10cSrcweir         pWin->ReleaseMouse();
1367cdf0e10cSrcweir         pTransferObj->StartDrag( pWin, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
1368cdf0e10cSrcweir     }
1369cdf0e10cSrcweir }
1370cdf0e10cSrcweir 
1371cdf0e10cSrcweir void ScContentTree::DoDrag()
1372cdf0e10cSrcweir {
1373cdf0e10cSrcweir     ScDocumentLoader* pDocLoader = NULL;
1374cdf0e10cSrcweir     bIsInDrag = sal_True;
1375cdf0e10cSrcweir 
1376cdf0e10cSrcweir     ScModule* pScMod = SC_MOD();
1377cdf0e10cSrcweir 
1378cdf0e10cSrcweir     sal_uInt16 nType;
1379cdf0e10cSrcweir     sal_uLong nChild;
1380cdf0e10cSrcweir     SvLBoxEntry* pEntry = GetCurEntry();
1381cdf0e10cSrcweir     GetEntryIndexes( nType, nChild, pEntry );
1382cdf0e10cSrcweir 
1383cdf0e10cSrcweir     if( pEntry &&
1384cdf0e10cSrcweir         (nChild != SC_CONTENT_NOCHILD) &&
1385cdf0e10cSrcweir         (nType != SC_CONTENT_ROOT) &&
1386cdf0e10cSrcweir         (nType != SC_CONTENT_NOTE) &&
1387cdf0e10cSrcweir         (nType != SC_CONTENT_AREALINK) )
1388cdf0e10cSrcweir     {
1389cdf0e10cSrcweir         String aText( GetEntryText( pEntry ) );
1390cdf0e10cSrcweir 
1391cdf0e10cSrcweir         ScDocument* pLocalDoc = NULL;                   // fuer URL-Drop
1392cdf0e10cSrcweir         String aDocName;
1393cdf0e10cSrcweir         if (bHiddenDoc)
1394cdf0e10cSrcweir             aDocName = aHiddenName;
1395cdf0e10cSrcweir         else
1396cdf0e10cSrcweir         {
1397cdf0e10cSrcweir             ScDocShell* pDocSh = GetManualOrCurrent();
1398cdf0e10cSrcweir             if (pDocSh)
1399cdf0e10cSrcweir             {
1400cdf0e10cSrcweir                 if (pDocSh->HasName())
1401cdf0e10cSrcweir                     aDocName = pDocSh->GetMedium()->GetName();
1402cdf0e10cSrcweir                 else
1403cdf0e10cSrcweir                     pLocalDoc = pDocSh->GetDocument();      // Drop nur in dieses Dokument
1404cdf0e10cSrcweir             }
1405cdf0e10cSrcweir         }
1406cdf0e10cSrcweir 
1407cdf0e10cSrcweir         sal_Bool bDoLinkTrans = sal_False;      // use ScLinkTransferObj
1408cdf0e10cSrcweir         String aLinkURL;                // for ScLinkTransferObj
1409cdf0e10cSrcweir         String aLinkText;
1410cdf0e10cSrcweir 
1411cdf0e10cSrcweir         sal_uInt16 nDropMode = pParentWindow->GetDropMode();
1412cdf0e10cSrcweir         switch ( nDropMode )
1413cdf0e10cSrcweir         {
1414cdf0e10cSrcweir             case SC_DROPMODE_URL:
1415cdf0e10cSrcweir                 {
1416cdf0e10cSrcweir                     String aUrl = aDocName;
1417cdf0e10cSrcweir                     aUrl += '#';
1418cdf0e10cSrcweir                     aUrl += aText;
1419cdf0e10cSrcweir 
1420cdf0e10cSrcweir                     pScMod->SetDragJump( pLocalDoc, aUrl, aText );
1421cdf0e10cSrcweir 
1422cdf0e10cSrcweir                     if (aDocName.Len())
1423cdf0e10cSrcweir                     {
1424cdf0e10cSrcweir                         //  provide URL to outside only if the document has a name
1425cdf0e10cSrcweir                         //  (without name, only internal D&D via SetDragJump)
1426cdf0e10cSrcweir 
1427cdf0e10cSrcweir                         aLinkURL = aUrl;
1428cdf0e10cSrcweir                         aLinkText = aText;
1429cdf0e10cSrcweir                     }
1430cdf0e10cSrcweir                     bDoLinkTrans = sal_True;
1431cdf0e10cSrcweir                 }
1432cdf0e10cSrcweir                 break;
1433cdf0e10cSrcweir             case SC_DROPMODE_LINK:
1434cdf0e10cSrcweir                 {
1435cdf0e10cSrcweir                     if ( aDocName.Len() )           // link only to named documents
1436cdf0e10cSrcweir                     {
1437cdf0e10cSrcweir                         // for internal D&D, set flag to insert a link
1438cdf0e10cSrcweir 
1439cdf0e10cSrcweir                         switch ( nType )
1440cdf0e10cSrcweir                         {
1441cdf0e10cSrcweir                             case SC_CONTENT_TABLE:
1442cdf0e10cSrcweir                                 pScMod->SetDragLink( aDocName, aText, EMPTY_STRING );
1443cdf0e10cSrcweir                                 bDoLinkTrans = sal_True;
1444cdf0e10cSrcweir                                 break;
1445cdf0e10cSrcweir                             case SC_CONTENT_RANGENAME:
1446cdf0e10cSrcweir                             case SC_CONTENT_DBAREA:
1447cdf0e10cSrcweir                                 pScMod->SetDragLink( aDocName, EMPTY_STRING, aText );
1448cdf0e10cSrcweir                                 bDoLinkTrans = sal_True;
1449cdf0e10cSrcweir                                 break;
1450cdf0e10cSrcweir 
1451cdf0e10cSrcweir                             // other types cannot be linked
1452cdf0e10cSrcweir                         }
1453cdf0e10cSrcweir                     }
1454cdf0e10cSrcweir                 }
1455cdf0e10cSrcweir                 break;
1456cdf0e10cSrcweir             case SC_DROPMODE_COPY:
1457cdf0e10cSrcweir                 {
1458cdf0e10cSrcweir                     ScDocShell* pSrcShell = NULL;
1459cdf0e10cSrcweir                     if ( bHiddenDoc )
1460cdf0e10cSrcweir                     {
1461cdf0e10cSrcweir                         String aFilter, aOptions;
1462cdf0e10cSrcweir                         pDocLoader = new ScDocumentLoader( aHiddenName, aFilter, aOptions );
1463cdf0e10cSrcweir                         if (!pDocLoader->IsError())
1464cdf0e10cSrcweir                             pSrcShell = pDocLoader->GetDocShell();
1465cdf0e10cSrcweir                     }
1466cdf0e10cSrcweir                     else
1467cdf0e10cSrcweir                         pSrcShell = GetManualOrCurrent();
1468cdf0e10cSrcweir 
1469cdf0e10cSrcweir                     if ( pSrcShell )
1470cdf0e10cSrcweir                     {
1471cdf0e10cSrcweir                         ScDocument* pSrcDoc = pSrcShell->GetDocument();
1472cdf0e10cSrcweir                         if ( nType == SC_CONTENT_RANGENAME || nType == SC_CONTENT_DBAREA )
1473cdf0e10cSrcweir                         {
1474cdf0e10cSrcweir                             ScRange aRange;
1475cdf0e10cSrcweir                             if ( lcl_GetRange( pSrcDoc, nType, aText, aRange ) )
1476cdf0e10cSrcweir                             {
1477cdf0e10cSrcweir                                 lcl_DoDragCells( pSrcShell, aRange, SC_DROP_NAVIGATOR, this );
1478cdf0e10cSrcweir                             }
1479cdf0e10cSrcweir                         }
1480cdf0e10cSrcweir                         else if ( nType == SC_CONTENT_TABLE )
1481cdf0e10cSrcweir                         {
1482cdf0e10cSrcweir                             SCTAB nTab;
1483cdf0e10cSrcweir                             if ( pSrcDoc->GetTable( aText, nTab ) )
1484cdf0e10cSrcweir                             {
1485cdf0e10cSrcweir                                 ScRange aRange( 0,0,nTab, MAXCOL,MAXROW,nTab );
1486cdf0e10cSrcweir                                 lcl_DoDragCells( pSrcShell, aRange, SC_DROP_NAVIGATOR | SC_DROP_TABLE, this );
1487cdf0e10cSrcweir                             }
1488cdf0e10cSrcweir                         }
1489cdf0e10cSrcweir                         else if ( nType == SC_CONTENT_GRAPHIC || nType == SC_CONTENT_OLEOBJECT ||
1490cdf0e10cSrcweir                                     nType == SC_CONTENT_DRAWING )
1491cdf0e10cSrcweir                         {
1492cdf0e10cSrcweir                             lcl_DoDragObject( pSrcShell, aText, nType, this );
1493cdf0e10cSrcweir 
1494cdf0e10cSrcweir                             //  in ExecuteDrag kann der Navigator geloescht worden sein
1495cdf0e10cSrcweir                             //  -> nicht mehr auf Member zugreifen !!!
1496cdf0e10cSrcweir                         }
1497cdf0e10cSrcweir                     }
1498cdf0e10cSrcweir                 }
1499cdf0e10cSrcweir                 break;
1500cdf0e10cSrcweir         }
1501cdf0e10cSrcweir 
1502cdf0e10cSrcweir         if (bDoLinkTrans)
1503cdf0e10cSrcweir         {
1504cdf0e10cSrcweir             ScLinkTransferObj* pTransferObj = new ScLinkTransferObj;
1505cdf0e10cSrcweir             uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
1506cdf0e10cSrcweir 
1507cdf0e10cSrcweir             if ( aLinkURL.Len() )
1508cdf0e10cSrcweir                 pTransferObj->SetLinkURL( aLinkURL, aLinkText );
1509cdf0e10cSrcweir 
1510cdf0e10cSrcweir             //  SetDragJump / SetDragLink has been done above
1511cdf0e10cSrcweir 
1512cdf0e10cSrcweir             ReleaseMouse();
1513cdf0e10cSrcweir             pTransferObj->StartDrag( this, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
1514cdf0e10cSrcweir         }
1515cdf0e10cSrcweir     }
1516cdf0e10cSrcweir 
1517cdf0e10cSrcweir     bIsInDrag = sal_False;              // static Member
1518cdf0e10cSrcweir 
1519cdf0e10cSrcweir     delete pDocLoader;              // falls Dokument zum Draggen geladen wurde
1520cdf0e10cSrcweir }
1521cdf0e10cSrcweir 
1522cdf0e10cSrcweir IMPL_STATIC_LINK(ScContentTree, ExecDragHdl, void*, EMPTYARG)
1523cdf0e10cSrcweir {
1524cdf0e10cSrcweir     //  als Link, damit asynchron ohne ImpMouseMoveMsg auf dem Stack auch der
1525cdf0e10cSrcweir     //  Navigator geloescht werden darf
1526cdf0e10cSrcweir 
1527cdf0e10cSrcweir     pThis->DoDrag();
1528cdf0e10cSrcweir     return 0;
1529cdf0e10cSrcweir }
1530cdf0e10cSrcweir 
1531cdf0e10cSrcweir //UNUSED2008-05  void ScContentTree::AdjustTitle()
1532cdf0e10cSrcweir //UNUSED2008-05  {
1533cdf0e10cSrcweir //UNUSED2008-05      String aTitle = pParentWindow->aTitleBase;
1534cdf0e10cSrcweir //UNUSED2008-05      if (bHiddenDoc)
1535cdf0e10cSrcweir //UNUSED2008-05      {
1536cdf0e10cSrcweir //UNUSED2008-05          aTitle.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " - " ));
1537cdf0e10cSrcweir //UNUSED2008-05          aTitle += aHiddenTitle;
1538cdf0e10cSrcweir //UNUSED2008-05      }
1539cdf0e10cSrcweir //UNUSED2008-05      pParentWindow->SetText(aTitle);
1540cdf0e10cSrcweir //UNUSED2008-05  }
1541cdf0e10cSrcweir 
1542cdf0e10cSrcweir sal_Bool ScContentTree::LoadFile( const String& rUrl )
1543cdf0e10cSrcweir {
1544cdf0e10cSrcweir     String aDocName = rUrl;
1545cdf0e10cSrcweir     xub_StrLen nPos = aDocName.Search('#');
1546cdf0e10cSrcweir     if ( nPos != STRING_NOTFOUND )
1547cdf0e10cSrcweir         aDocName.Erase(nPos);           // nur der Name, ohne #...
1548cdf0e10cSrcweir 
1549cdf0e10cSrcweir     sal_Bool bReturn = sal_False;
1550cdf0e10cSrcweir     String aFilter, aOptions;
1551cdf0e10cSrcweir     ScDocumentLoader aLoader( aDocName, aFilter, aOptions );
1552cdf0e10cSrcweir     if ( !aLoader.IsError() )
1553cdf0e10cSrcweir     {
1554cdf0e10cSrcweir         bHiddenDoc = sal_True;
1555cdf0e10cSrcweir         aHiddenName = aDocName;
1556cdf0e10cSrcweir         aHiddenTitle = aLoader.GetTitle();
1557cdf0e10cSrcweir         pHiddenDocument = aLoader.GetDocument();
1558cdf0e10cSrcweir 
1559cdf0e10cSrcweir         Refresh();                      // Inhalte aus geladenem Dokument holen
1560cdf0e10cSrcweir 
1561cdf0e10cSrcweir         pHiddenDocument = NULL;
1562cdf0e10cSrcweir //      AdjustTitle();
1563cdf0e10cSrcweir 
1564cdf0e10cSrcweir         pParentWindow->GetDocNames( &aHiddenTitle );            // Liste fuellen
1565cdf0e10cSrcweir     }
1566cdf0e10cSrcweir     else
1567cdf0e10cSrcweir         Sound::Beep();          // Fehler beim Laden
1568cdf0e10cSrcweir 
1569cdf0e10cSrcweir     //  Dokument wird im dtor von ScDocumentLoader wieder geschlossen
1570cdf0e10cSrcweir 
1571cdf0e10cSrcweir     return bReturn;
1572cdf0e10cSrcweir }
1573cdf0e10cSrcweir 
1574cdf0e10cSrcweir void ScContentTree::InitWindowBits( sal_Bool bButtons )
1575cdf0e10cSrcweir {
1576cdf0e10cSrcweir     WinBits nFlags = GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL;
1577cdf0e10cSrcweir     if (bButtons)
1578cdf0e10cSrcweir         nFlags |= WB_HASBUTTONS|WB_HASBUTTONSATROOT;
1579cdf0e10cSrcweir 
1580cdf0e10cSrcweir     SetStyle( nFlags );
1581cdf0e10cSrcweir }
1582cdf0e10cSrcweir 
1583cdf0e10cSrcweir void ScContentTree::SetRootType( sal_uInt16 nNew )
1584cdf0e10cSrcweir {
1585cdf0e10cSrcweir     if ( nNew != nRootType )
1586cdf0e10cSrcweir     {
1587cdf0e10cSrcweir         nRootType = nNew;
1588cdf0e10cSrcweir         InitWindowBits( nNew == 0 );
1589cdf0e10cSrcweir         Refresh();
1590cdf0e10cSrcweir 
1591cdf0e10cSrcweir         ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg();
1592cdf0e10cSrcweir         rCfg.SetRootType( nRootType );
1593cdf0e10cSrcweir     }
1594cdf0e10cSrcweir }
1595cdf0e10cSrcweir 
1596cdf0e10cSrcweir void ScContentTree::ToggleRoot()        // nach Selektion
1597cdf0e10cSrcweir {
1598cdf0e10cSrcweir     sal_uInt16 nNew = SC_CONTENT_ROOT;
1599cdf0e10cSrcweir     if ( nRootType == SC_CONTENT_ROOT )
1600cdf0e10cSrcweir     {
1601cdf0e10cSrcweir         SvLBoxEntry* pEntry = GetCurEntry();
1602cdf0e10cSrcweir         if (pEntry)
1603cdf0e10cSrcweir         {
1604cdf0e10cSrcweir             SvLBoxEntry* pParent = GetParent(pEntry);
1605cdf0e10cSrcweir             for (sal_uInt16 i=1; i<SC_CONTENT_COUNT; i++)
1606cdf0e10cSrcweir                 if ( pEntry == pRootNodes[i] || pParent == pRootNodes[i] )
1607cdf0e10cSrcweir                     nNew = i;
1608cdf0e10cSrcweir         }
1609cdf0e10cSrcweir     }
1610cdf0e10cSrcweir 
1611cdf0e10cSrcweir     SetRootType( nNew );
1612cdf0e10cSrcweir }
1613cdf0e10cSrcweir 
1614cdf0e10cSrcweir void ScContentTree::ResetManualDoc()
1615cdf0e10cSrcweir {
1616cdf0e10cSrcweir     aManualDoc.Erase();
1617cdf0e10cSrcweir     bHiddenDoc = sal_False;
1618cdf0e10cSrcweir 
1619cdf0e10cSrcweir     ActiveDocChanged();
1620cdf0e10cSrcweir }
1621cdf0e10cSrcweir 
1622cdf0e10cSrcweir void ScContentTree::ActiveDocChanged()
1623cdf0e10cSrcweir {
1624cdf0e10cSrcweir     if ( !bHiddenDoc && !aManualDoc.Len() )
1625cdf0e10cSrcweir         Refresh();                                  // Inhalte nur wenn automatisch
1626cdf0e10cSrcweir 
1627cdf0e10cSrcweir         //  Listbox muss immer geupdated werden, wegen aktiv-Flag
1628cdf0e10cSrcweir 
1629cdf0e10cSrcweir     String aCurrent;
1630cdf0e10cSrcweir     if ( bHiddenDoc )
1631cdf0e10cSrcweir         aCurrent = aHiddenTitle;
1632cdf0e10cSrcweir     else
1633cdf0e10cSrcweir     {
1634cdf0e10cSrcweir         ScDocShell* pSh = GetManualOrCurrent();
1635cdf0e10cSrcweir         if (pSh)
1636cdf0e10cSrcweir             aCurrent = pSh->GetTitle();
1637cdf0e10cSrcweir         else
1638cdf0e10cSrcweir         {
1639cdf0e10cSrcweir             //  eingestelltes Dokument existiert nicht mehr
1640cdf0e10cSrcweir 
1641cdf0e10cSrcweir             aManualDoc.Erase();             // wieder automatisch
1642cdf0e10cSrcweir             Refresh();
1643cdf0e10cSrcweir             pSh = GetManualOrCurrent();     // sollte jetzt aktives sein
1644cdf0e10cSrcweir             if (pSh)
1645cdf0e10cSrcweir                 aCurrent = pSh->GetTitle();
1646cdf0e10cSrcweir         }
1647cdf0e10cSrcweir     }
1648cdf0e10cSrcweir     pParentWindow->GetDocNames( &aCurrent );        // selektieren
1649cdf0e10cSrcweir }
1650cdf0e10cSrcweir 
1651cdf0e10cSrcweir void ScContentTree::SetManualDoc(const String& rName)
1652cdf0e10cSrcweir {
1653cdf0e10cSrcweir     aManualDoc = rName;
1654cdf0e10cSrcweir     if (!bHiddenDoc)
1655cdf0e10cSrcweir     {
1656cdf0e10cSrcweir         Refresh();
1657cdf0e10cSrcweir         pParentWindow->GetDocNames( &aManualDoc );      // selektieren
1658cdf0e10cSrcweir     }
1659cdf0e10cSrcweir }
1660cdf0e10cSrcweir 
1661cdf0e10cSrcweir void ScContentTree::SelectDoc(const String& rName)      // rName wie im Menue/Listbox angezeigt
1662cdf0e10cSrcweir {
1663cdf0e10cSrcweir     if ( rName == pParentWindow->aStrActiveWin )
1664cdf0e10cSrcweir     {
1665cdf0e10cSrcweir         ResetManualDoc();
1666cdf0e10cSrcweir         return;
1667cdf0e10cSrcweir     }
1668cdf0e10cSrcweir 
1669cdf0e10cSrcweir     //  "aktiv" oder "inaktiv" weglassen
1670cdf0e10cSrcweir 
1671cdf0e10cSrcweir     String aRealName = rName;
1672cdf0e10cSrcweir     xub_StrLen nLen = rName.Len();
1673cdf0e10cSrcweir     xub_StrLen nActiveStart = nLen - pParentWindow->aStrActive.Len();
1674cdf0e10cSrcweir     if ( rName.Copy( nActiveStart ) == pParentWindow->aStrActive )
1675cdf0e10cSrcweir         aRealName = rName.Copy( 0, nActiveStart );
1676cdf0e10cSrcweir     xub_StrLen nNotActiveStart = nLen - pParentWindow->aStrNotActive.Len();
1677cdf0e10cSrcweir     if ( rName.Copy( nNotActiveStart ) == pParentWindow->aStrNotActive )
1678cdf0e10cSrcweir         aRealName = rName.Copy( 0, nNotActiveStart );
1679cdf0e10cSrcweir 
1680cdf0e10cSrcweir     //
1681cdf0e10cSrcweir 
1682cdf0e10cSrcweir     sal_Bool bLoaded = sal_False;
1683cdf0e10cSrcweir 
1684cdf0e10cSrcweir         // ist es ein normal geladenes Doc ?
1685cdf0e10cSrcweir 
1686cdf0e10cSrcweir     SfxObjectShell* pSh = SfxObjectShell::GetFirst();
1687cdf0e10cSrcweir     while ( pSh && !bLoaded )
1688cdf0e10cSrcweir     {
1689cdf0e10cSrcweir         if ( pSh->ISA(ScDocShell) )
1690cdf0e10cSrcweir             if ( pSh->GetTitle() == aRealName )
1691cdf0e10cSrcweir                 bLoaded = sal_True;
1692cdf0e10cSrcweir         pSh = SfxObjectShell::GetNext( *pSh );
1693cdf0e10cSrcweir     }
1694cdf0e10cSrcweir 
1695cdf0e10cSrcweir     if (bLoaded)
1696cdf0e10cSrcweir     {
1697cdf0e10cSrcweir         bHiddenDoc = sal_False;
1698cdf0e10cSrcweir         SetManualDoc(aRealName);
1699cdf0e10cSrcweir     }
1700cdf0e10cSrcweir     else if (aHiddenTitle.Len())                // verstecktes ausgewaehlt
1701cdf0e10cSrcweir     {
1702cdf0e10cSrcweir         if (!bHiddenDoc)
1703cdf0e10cSrcweir             LoadFile(aHiddenName);
1704cdf0e10cSrcweir     }
1705cdf0e10cSrcweir     else
1706cdf0e10cSrcweir     {
1707cdf0e10cSrcweir         DBG_ERROR("SelectDoc: nicht gefunden");
1708cdf0e10cSrcweir     }
1709cdf0e10cSrcweir }
1710cdf0e10cSrcweir 
1711cdf0e10cSrcweir void ScContentTree::ApplySettings()
1712cdf0e10cSrcweir {
1713cdf0e10cSrcweir     const ScNavigatorSettings* pSettings = pParentWindow->GetNavigatorSettings();
1714cdf0e10cSrcweir     if( pSettings )
1715cdf0e10cSrcweir     {
1716cdf0e10cSrcweir         sal_uInt16 nRootSel = pSettings->GetRootSelected();
1717cdf0e10cSrcweir         sal_uLong nChildSel = pSettings->GetChildSelected();
1718cdf0e10cSrcweir 
1719cdf0e10cSrcweir         for( sal_uInt16 nEntry = 1; nEntry < SC_CONTENT_COUNT; ++nEntry )
1720cdf0e10cSrcweir         {
1721cdf0e10cSrcweir             if( pRootNodes[ nEntry ] )
1722cdf0e10cSrcweir             {
1723cdf0e10cSrcweir                 // expand
1724cdf0e10cSrcweir                 sal_Bool bExp = pSettings->IsExpanded( nEntry );
1725cdf0e10cSrcweir                 if( bExp != IsExpanded( pRootNodes[ nEntry ] ) )
1726cdf0e10cSrcweir                 {
1727cdf0e10cSrcweir                     if( bExp )
1728cdf0e10cSrcweir                         Expand( pRootNodes[ nEntry ] );
1729cdf0e10cSrcweir                     else
1730cdf0e10cSrcweir                         Collapse( pRootNodes[ nEntry ] );
1731cdf0e10cSrcweir                 }
1732cdf0e10cSrcweir 
1733cdf0e10cSrcweir                 // select
1734cdf0e10cSrcweir                 if( nRootSel == nEntry )
1735cdf0e10cSrcweir                 {
1736cdf0e10cSrcweir                     SvLBoxEntry* pEntry = NULL;
1737cdf0e10cSrcweir                     if( bExp && (nChildSel != SC_CONTENT_NOCHILD) )
1738cdf0e10cSrcweir                         pEntry = GetEntry( pRootNodes[ nEntry ], nChildSel );
1739cdf0e10cSrcweir                     Select( pEntry ? pEntry : pRootNodes[ nEntry ] );
1740cdf0e10cSrcweir                 }
1741cdf0e10cSrcweir             }
1742cdf0e10cSrcweir         }
1743cdf0e10cSrcweir     }
1744cdf0e10cSrcweir }
1745cdf0e10cSrcweir 
1746cdf0e10cSrcweir void ScContentTree::StoreSettings() const
1747cdf0e10cSrcweir {
1748cdf0e10cSrcweir     ScNavigatorSettings* pSettings = pParentWindow->GetNavigatorSettings();
1749cdf0e10cSrcweir     if( pSettings )
1750cdf0e10cSrcweir     {
1751cdf0e10cSrcweir         for( sal_uInt16 nEntry = 1; nEntry < SC_CONTENT_COUNT; ++nEntry )
1752cdf0e10cSrcweir         {
1753cdf0e10cSrcweir             sal_Bool bExp = pRootNodes[ nEntry ] && IsExpanded( pRootNodes[ nEntry ] );
1754cdf0e10cSrcweir             pSettings->SetExpanded( nEntry, bExp );
1755cdf0e10cSrcweir         }
1756cdf0e10cSrcweir         sal_uInt16 nRoot;
1757cdf0e10cSrcweir         sal_uLong nChild;
1758cdf0e10cSrcweir         GetEntryIndexes( nRoot, nChild, GetCurEntry() );
1759cdf0e10cSrcweir         pSettings->SetRootSelected( nRoot );
1760cdf0e10cSrcweir         pSettings->SetChildSelected( nChild );
1761cdf0e10cSrcweir     }
1762cdf0e10cSrcweir }
1763cdf0e10cSrcweir 
1764*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
1765*0deba7fbSSteve Yin class ScContentLBoxString : public SvLBoxString
1766*0deba7fbSSteve Yin {
1767*0deba7fbSSteve Yin public:
1768*0deba7fbSSteve Yin     ScContentLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags,
1769*0deba7fbSSteve Yin         const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr) {}
1770cdf0e10cSrcweir 
1771*0deba7fbSSteve Yin     virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
1772*0deba7fbSSteve Yin         SvLBoxEntry* pEntry);
1773*0deba7fbSSteve Yin };
1774*0deba7fbSSteve Yin void ScContentTree::InitEntry(SvLBoxEntry* pEntry,
1775*0deba7fbSSteve Yin         const XubString& rStr ,const Image& rImg1,const Image& rImg2, SvLBoxButtonKind eButtonKind)
1776*0deba7fbSSteve Yin {
1777*0deba7fbSSteve Yin     sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2"
1778*0deba7fbSSteve Yin     SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
1779*0deba7fbSSteve Yin     SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite );
1780*0deba7fbSSteve Yin     ScContentLBoxString* pStr = new ScContentLBoxString( pEntry, 0, pCol->GetText() );
1781*0deba7fbSSteve Yin     pEntry->ReplaceItem( pStr, nColToHilite );
1782*0deba7fbSSteve Yin }
1783*0deba7fbSSteve Yin void ScContentLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
1784*0deba7fbSSteve Yin     SvLBoxEntry* pEntry )
1785*0deba7fbSSteve Yin {
1786*0deba7fbSSteve Yin     // IA2 CWS. MT: Removed for now (also in SvLBoxEntry) - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this
1787*0deba7fbSSteve Yin     /*
1788*0deba7fbSSteve Yin     if (pEntry->IsMarked())
1789*0deba7fbSSteve Yin     {
1790*0deba7fbSSteve Yin             rDev.DrawText( rPos, GetText() );
1791*0deba7fbSSteve Yin             XubString str;
1792*0deba7fbSSteve Yin             str = XubString::CreateFromAscii("*");
1793*0deba7fbSSteve Yin             Point rPosStar(rPos.X()-6,rPos.Y());
1794*0deba7fbSSteve Yin             Font aOldFont( rDev.GetFont());
1795*0deba7fbSSteve Yin             Font aFont(aOldFont);
1796*0deba7fbSSteve Yin             Color aCol( aOldFont.GetColor() );
1797*0deba7fbSSteve Yin             aCol.DecreaseLuminance( 200 );
1798*0deba7fbSSteve Yin             aFont.SetColor( aCol );
1799*0deba7fbSSteve Yin             rDev.SetFont( aFont );
1800*0deba7fbSSteve Yin             rDev.DrawText( rPosStar, str);
1801*0deba7fbSSteve Yin             rDev.SetFont( aOldFont );
1802*0deba7fbSSteve Yin     }
1803*0deba7fbSSteve Yin     else
1804*0deba7fbSSteve Yin     */
1805*0deba7fbSSteve Yin         SvLBoxString::Paint( rPos, rDev, nFlags, pEntry);
1806*0deba7fbSSteve Yin }
1807*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009
1808cdf0e10cSrcweir //
1809cdf0e10cSrcweir //------------------------------------------------------------------------
1810cdf0e10cSrcweir //
1811cdf0e10cSrcweir 
1812cdf0e10cSrcweir 
1813cdf0e10cSrcweir 
1814cdf0e10cSrcweir 
1815cdf0e10cSrcweir 
1816