summaryrefslogtreecommitdiff
path: root/sc/source/ui/navipi
diff options
context:
space:
mode:
authorSteve Yin <steve_y@apache.org>2013-12-02 15:54:29 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-12-02 16:41:08 +0000
commitb41332475783c31136673fb44cf4c411bb0148f8 (patch)
tree39ba57867ed6ae3f39e60c38180f800542067b49 /sc/source/ui/navipi
parent23fdf75cd6e6cb37bfeac08f503a15d07d9beda9 (diff)
Integrate branch of IAccessible2
Conflicts: everything Change-Id: I3d8cf956f511a0d953a1cefe83b6ef987806da25
Diffstat (limited to 'sc/source/ui/navipi')
-rw-r--r--sc/source/ui/navipi/content.cxx252
-rw-r--r--sc/source/ui/navipi/navipi.cxx7
2 files changed, 245 insertions, 14 deletions
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 69bcec78fa60..e8c11f5abdc1 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -30,7 +30,8 @@
#include <vcl/svapp.hxx>
#include <tools/urlobj.hxx>
#include <svl/urlbmk.hxx>
-#include "svtools/svlbitm.hxx"
+#include <svtools/svlbitm.hxx>
+#include <svtools/treelistentry.hxx>
#include <stdlib.h>
#include "content.hxx"
@@ -55,6 +56,8 @@
#include "navicfg.hxx"
#include "navsett.hxx"
#include "postit.hxx"
+#include "tabvwsh.hxx"
+#include "drawview.hxx"
#include "clipparam.hxx"
#include "markdata.hxx"
@@ -117,7 +120,8 @@ ScContentTree::ScContentTree( Window* pParent, const ResId& rResId ) :
aEntryImages ( ScResId( RID_IMAGELIST_NAVCONT ) ),
nRootType ( SC_CONTENT_ROOT ),
bHiddenDoc ( false ),
- pHiddenDocument ( NULL )
+ pHiddenDocument ( NULL ),
+ bisInNavigatoeDlg ( sal_False )
{
sal_uInt16 i;
for (i=0; i<SC_CONTENT_COUNT; i++)
@@ -133,6 +137,9 @@ ScContentTree::ScContentTree( Window* pParent, const ResId& rResId ) :
SetDoubleClickHdl( LINK( this, ScContentTree, ContentDoubleClickHdl ) );
+ pTmpEntry= NULL;
+ m_bFirstPaint=true;
+
SetStyle( GetStyle() | WB_QUICK_SEARCH );
}
@@ -140,6 +147,70 @@ ScContentTree::~ScContentTree()
{
}
+// helper function for GetEntryAltText and GetEntryLongDescription
+OUString ScContentTree::getAltLongDescText( SvTreeListEntry* pEntry , sal_Bool isAltText) const
+{
+ SdrObject* pFound = NULL;
+
+ sal_uInt16 nType;
+ sal_uLong nChild;
+ GetEntryIndexes( nType, nChild, pEntry );
+ switch( nType )
+ {
+ case SC_CONTENT_OLEOBJECT:
+ case SC_CONTENT_GRAPHIC:
+ case SC_CONTENT_DRAWING:
+ {
+ ScDocument* pDoc = ( const_cast< ScContentTree* >(this) )->GetSourceDocument();
+ SdrIterMode eIter = ( nType == SC_CONTENT_DRAWING ) ? IM_FLAT : IM_DEEPNOGROUPS;
+ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
+ if (pDrawLayer && pShell)
+ {
+ sal_uInt16 nTabCount = pDoc->GetTableCount();
+ for (sal_uInt16 nTab=0; nTab<nTabCount; nTab++)
+ {
+ SdrPage* pPage = pDrawLayer->GetPage(nTab);
+ DBG_ASSERT(pPage,"Page ?");
+ if (pPage)
+ {
+ SdrObjListIter aIter( *pPage, eIter );
+ SdrObject* pObject = aIter.Next();
+ while (pObject)
+ {
+ if( ScDrawLayer::GetVisibleName( pObject ) == GetEntryText( pEntry ) )
+ {
+ pFound = pObject;
+ break;
+ }
+ pObject = aIter.Next();
+ }
+ }
+ }
+ }
+ if( pFound )
+ {
+ if( isAltText )
+ return pFound->GetTitle();
+ else
+ return pFound->GetDescription();
+ }
+ }
+ break;
+ }
+ return OUString();
+}
+
+OUString ScContentTree::GetEntryAltText( SvTreeListEntry* pEntry ) const
+{
+ return getAltLongDescText( pEntry, sal_True );
+}
+
+OUString ScContentTree::GetEntryLongDescription( SvTreeListEntry* pEntry ) const
+{
+ return getAltLongDescText( pEntry, sal_False);
+}
+
void ScContentTree::InitRoot( sal_uInt16 nType )
{
if ( !nType )
@@ -162,7 +233,15 @@ void ScContentTree::InitRoot( sal_uInt16 nType )
void ScContentTree::ClearAll()
{
+ //There are one method in Control::SetUpdateMode(), and one override method SvTreeListBox::SetUpdateMode(). Here although
+ //SvTreeListBox::SetUpdateMode() is called in refresh method, it only call SvTreeListBox::SetUpdateMode(), not Control::SetUpdateMode().
+ //In SvTreeList::Clear(), Broadcast( LISTACTION_CLEARED ) will be called and finally, it will be trapped into the event yield() loop. And
+ //the InitRoot() method won't be called. Then if a user click or press key to update the navigator tree, crash happens.
+ //So the solution is to disable the UpdateMode of Control, then call Clear(), then recover the update mode
+ sal_Bool bOldUpdate = Control::IsUpdateMode();
+ Control::SetUpdateMode(sal_False);
Clear();
+ Control::SetUpdateMode(bOldUpdate);
for (sal_uInt16 i=1; i<SC_CONTENT_COUNT; i++)
InitRoot(i);
}
@@ -383,10 +462,80 @@ void ScContentTree::KeyInput( const KeyEvent& rKEvt )
break;
}
}
- StoreSettings();
+ //Make KEY_SPACE has same function as DoubleClick
+ if ( bisInNavigatoeDlg )
+ {
+ if(aCode.GetCode() == KEY_SPACE )
+ {
+ bUsed = sal_True;
+ sal_uInt16 nType;
+ sal_uLong nChild;
+ SvTreeListEntry* pEntry = GetCurEntry();
+ GetEntryIndexes( nType, nChild, pEntry );
+ if( pEntry && (nType != SC_CONTENT_ROOT) && (nChild != SC_CONTENT_NOCHILD) )
+ {
+ if ( bHiddenDoc )
+ return ; //! spaeter...
+ OUString aText( GetEntryText( pEntry ) );
+ sKeyString = aText;
+ if (!aManualDoc.isEmpty())
+ pParentWindow->SetCurrentDoc( aManualDoc );
+ switch( nType )
+ {
+ case SC_CONTENT_OLEOBJECT:
+ case SC_CONTENT_GRAPHIC:
+ case SC_CONTENT_DRAWING:
+ {
+ Window* pWindow=(Window*)GetParent(pEntry);
+ ScNavigatorDlg* pScNavigatorDlg = (ScNavigatorDlg*)pWindow;
+ ScTabViewShell* pScTabViewShell = NULL;
+ ScDrawView* pScDrawView = NULL;
+ if (pScNavigatorDlg!=NULL)
+ pScTabViewShell=pScNavigatorDlg->GetTabViewShell();
+ if(pScTabViewShell !=NULL)
+ pScDrawView =pScTabViewShell->GetViewData()->GetScDrawView();
+ if(pScDrawView!=NULL)
+ {
+ pScDrawView->SelectCurrentViewObject(aText );
+ sal_Bool bHasMakredObject = sal_False;
+ SvTreeListEntry* pParent = pRootNodes[nType];
+ SvTreeListEntry* pBeginEntry = NULL;
+ if( pParent )
+ pBeginEntry = FirstChild(pParent);
+ while( pBeginEntry )
+ {
+ OUString aTempText( GetEntryText( pBeginEntry ) );
+ if( pScDrawView->GetObjectIsMarked( pScDrawView->GetObjectByName( aTempText ) ) )
+ {
+ bHasMakredObject = sal_True;
+ break;
+ }
+ pBeginEntry = Next( pBeginEntry );
+ }
+ if( !bHasMakredObject && pScTabViewShell)
+ pScTabViewShell->SetDrawShell(sal_False);
+ ObjectFresh( nType,pEntry );
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
if( !bUsed )
- SvTreeListBox::KeyInput(rKEvt);
+ {
+ if(aCode.GetCode() == KEY_F5 )
+ {
+ StoreSettings();
+ SvTreeListBox::KeyInput(rKEvt);
+ }
+ else
+ {
+ SvTreeListBox::KeyInput(rKEvt);
+ StoreSettings();
+ }
+ }
}
sal_Int8 ScContentTree::AcceptDrop( const AcceptDropEvent& /* rEvt */ )
@@ -574,6 +723,45 @@ ScDocument* ScContentTree::GetSourceDocument()
return NULL;
}
+//Move along and draw "*" sign .
+void ScContentTree::ObjectFresh( sal_uInt16 nType, SvTreeListEntry* pEntry )
+{
+ if ( bHiddenDoc && !pHiddenDocument )
+ return; // anderes Dokument angezeigt
+ if(nType ==SC_CONTENT_GRAPHIC||nType ==SC_CONTENT_OLEOBJECT||nType ==SC_CONTENT_DRAWING)
+ {
+ SetUpdateMode(sal_False);
+ ClearType( nType );
+ GetDrawNames( nType/*, nId*/ );
+ if( !pEntry )
+ ApplySettings();
+ SetUpdateMode(sal_True);
+ if( pEntry )
+ {
+ SvTreeListEntry* pParent = pRootNodes[nType];
+ SvTreeListEntry* pBeginEntry = NULL;
+ SvTreeListEntry* pOldEntry = NULL;
+ if( pParent )
+ pBeginEntry = FirstChild(pParent);
+ while( pBeginEntry )
+ {
+ OUString aTempText( GetEntryText( pBeginEntry ) );
+ if( aTempText == sKeyString )
+ {
+ pOldEntry = pBeginEntry;
+ break;
+ }
+ pBeginEntry = Next( pBeginEntry );
+ }
+ if( pOldEntry )
+ {
+ Expand(pParent);
+ Select( pOldEntry,sal_True);
+ }
+ }
+ }
+}
+
void ScContentTree::Refresh( sal_uInt16 nType )
{
if ( bHiddenDoc && !pHiddenDocument )
@@ -765,7 +953,44 @@ void ScContentTree::GetDrawNames( sal_uInt16 nType )
{
OUString aName = ScDrawLayer::GetVisibleName( pObject );
if (!aName.isEmpty())
- InsertContent( nType, aName );
+ {
+ if( bisInNavigatoeDlg )
+ {
+ if (nType >= SC_CONTENT_COUNT)
+ {
+ SAL_WARN("sc", "ScContentTree::InsertContent mit falschem Typ");
+ return;
+ }
+
+ SvTreeListEntry* pParent = pRootNodes[nType];
+ if (pParent)
+ {
+ SvTreeListEntry* pChild=InsertEntry( aName, pParent );
+ if(pChild)
+ pChild->SetMarked( sal_False);
+ Window* pWindow=NULL;
+ ScTabViewShell* pScTabViewShell=NULL;
+ ScDrawView* pScDrawView=NULL;
+ ScNavigatorDlg* pScNavigatorDlg=NULL;
+ if(pChild)
+ pWindow=(Window*)GetParent(pChild);
+ if(pWindow)
+ pScNavigatorDlg = (ScNavigatorDlg*)pWindow;
+ if (pScNavigatorDlg!=NULL)
+ pScTabViewShell=pScNavigatorDlg->GetTabViewShell();
+ if(pScTabViewShell !=NULL)
+ pScDrawView =pScTabViewShell->GetViewData()->GetScDrawView();
+ if(pScDrawView!=NULL)
+ {
+ sal_Bool bMarked =pScDrawView->GetObjectIsMarked(pObject);
+ pChild->SetMarked( bMarked );
+ }
+ }//end if parent
+ else
+ SAL_WARN("sc", "InsertContent ohne Parent");
+ }
+ }
+
}
pObject = aIter.Next();
@@ -1445,13 +1670,14 @@ void ScContentTree::StoreSettings() const
}
}
-
-//
-//------------------------------------------------------------------------
-//
-
-
-
-
+void ScContentTree::InitEntry(SvTreeListEntry* pEntry,
+ const OUString& rStr, const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind)
+{
+ sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2"
+ SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
+ SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite );
+ SvLBoxString* pStr = new SvLBoxString( pEntry, 0, pCol->GetText() );
+ pEntry->ReplaceItem( pStr, nColToHilite );
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index 5c918dc351f8..d69184451c79 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -741,6 +741,7 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Win
aTbxCmd.Select(IID_ZOOMOUT);
aTbxCmd.RemoveItem(aTbxCmd.GetItemPos(IID_ZOOMOUT));
}
+ aLbEntries.SetNavigatorDlgFlag(sal_True);
}
//------------------------------------------------------------------------
@@ -934,7 +935,11 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint )
case FID_ANYDATACHANGED:
aContentTimer.Start(); // Notizen nicht sofort suchen
break;
-
+ case FID_KILLEDITVIEW:
+ aLbEntries.ObjectFresh( SC_CONTENT_OLEOBJECT );
+ aLbEntries.ObjectFresh( SC_CONTENT_DRAWING );
+ aLbEntries.ObjectFresh( SC_CONTENT_GRAPHIC );
+ break;
default:
break;
}