1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: content.hxx,v $
10 * $Revision: 1.13.32.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_CONTENT_HXX
32 #define SC_CONTENT_HXX
34 #include <svtools/svtreebx.hxx>
36 #include "address.hxx"
37 #include <tools/solar.h>
40 class ScNavigatorSettings
;
45 #define SC_CONTENT_ROOT 0
46 #define SC_CONTENT_TABLE 1
47 #define SC_CONTENT_RANGENAME 2
48 #define SC_CONTENT_DBAREA 3
49 #define SC_CONTENT_GRAPHIC 4
50 #define SC_CONTENT_OLEOBJECT 5
51 #define SC_CONTENT_NOTE 6
52 #define SC_CONTENT_AREALINK 7
53 #define SC_CONTENT_DRAWING 8
54 #define SC_CONTENT_COUNT 9
56 const ULONG SC_CONTENT_NOCHILD
= ~0UL;
59 // TreeListBox fuer Inhalte
62 class ScContentTree
: public SvTreeListBox
64 ScNavigatorDlg
* pParentWindow
;
65 ImageList aEntryImages
;
66 ImageList aHCEntryImages
;
67 SvLBoxEntry
* pRootNodes
[SC_CONTENT_COUNT
];
68 USHORT nRootType
; // als Root eingestellt
69 String aManualDoc
; // im Navigator umgeschaltet (Title)
70 BOOL bHiddenDoc
; // verstecktes aktiv?
71 String aHiddenName
; // URL zum Laden
72 String aHiddenTitle
; // fuer Anzeige
73 ScDocument
* pHiddenDocument
; // temporaer
75 USHORT pPosList
[SC_CONTENT_COUNT
]; // fuer die Reihenfolge
77 static BOOL bIsInDrag
; // static, falls der Navigator im ExecuteDrag geloescht wird
79 ScDocShell
* GetManualOrCurrent();
81 void InitRoot(USHORT nType
);
82 void ClearType(USHORT nType
);
84 void InsertContent( USHORT nType
, const String
& rValue
);
85 void GetDrawNames( USHORT nType
);
91 void GetGraphicNames();
93 void GetDrawingNames();
94 void GetNoteStrings();
96 static bool IsPartOfType( USHORT nContentType
, USHORT nObjIdentifier
);
98 BOOL
DrawNamesChanged( USHORT nType
);
99 BOOL
NoteStringsChanged();
101 ScAddress
GetNotePos( ULONG nIndex
);
102 const ScAreaLink
* GetLink( ULONG nIndex
);
104 /** Returns the indexes of the specified listbox entry.
105 @param rnRootIndex Root index of specified entry is returned.
106 @param rnChildIndex Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root).
107 @param pEntry The entry to examine. */
108 void GetEntryIndexes( USHORT
& rnRootIndex
, ULONG
& rnChildIndex
, SvLBoxEntry
* pEntry
) const;
110 /** Returns the child index of the specified listbox entry.
111 @param pEntry The entry to examine or NULL for the selected entry.
112 @return Index of the entry inside its root or SC_CONTENT_NOCHILD if entry is root. */
113 ULONG
GetChildIndex( SvLBoxEntry
* pEntry
) const;
116 //UNUSED2008-05 void AdjustTitle();
118 ScDocument
* GetSourceDocument();
120 DECL_LINK( ContentDoubleClickHdl
, ScContentTree
* );
121 DECL_STATIC_LINK( ScContentTree
, ExecDragHdl
, void* );
124 // virtual BOOL Drop( const DropEvent& rEvt );
125 // virtual BOOL QueryDrop( DropEvent& rEvt );
127 using SvTreeListBox::ExecuteDrop
;
129 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
);
130 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
);
131 virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
);
132 virtual void DragFinished( sal_Int8 nAction
);
134 virtual void Command( const CommandEvent
& rCEvt
);
135 virtual void RequestHelp( const HelpEvent
& rHEvt
);
138 ScContentTree( Window
* pParent
, const ResId
& rResId
);
141 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
142 virtual void KeyInput( const KeyEvent
& rKEvt
);
144 void InitWindowBits( BOOL bButtons
);
146 void Refresh( USHORT nType
= 0 );
149 void SetRootType( USHORT nNew
);
150 USHORT
GetRootType() const { return nRootType
; }
152 void ActiveDocChanged();
153 void ResetManualDoc();
154 void SetManualDoc(const String
& rName
);
155 BOOL
LoadFile(const String
& rUrl
);
156 void SelectDoc(const String
& rName
);
158 const String
& GetHiddenTitle() const { return aHiddenTitle
; }
160 /** Applies the navigator settings to the listbox. */
161 void ApplySettings();
162 /** Stores the current listbox state in the navigator settings. */
163 void StoreSettings() const;
165 static BOOL
IsInDrag() { return bIsInDrag
; }
171 #endif // SC_NAVIPI_HXX