xref: /trunk/main/sc/source/ui/inc/content.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_CONTENT_HXX
25cdf0e10cSrcweir #define SC_CONTENT_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svtools/svtreebx.hxx>
28cdf0e10cSrcweir #include "global.hxx"
29cdf0e10cSrcweir #include "address.hxx"
30cdf0e10cSrcweir #include <tools/solar.h>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir class ScNavigatorDlg;
33cdf0e10cSrcweir class ScNavigatorSettings;
34cdf0e10cSrcweir class ScDocument;
35cdf0e10cSrcweir class ScDocShell;
36cdf0e10cSrcweir class ScAreaLink;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #define SC_CONTENT_ROOT         0
39cdf0e10cSrcweir #define SC_CONTENT_TABLE        1
40cdf0e10cSrcweir #define SC_CONTENT_RANGENAME    2
41cdf0e10cSrcweir #define SC_CONTENT_DBAREA       3
42cdf0e10cSrcweir #define SC_CONTENT_GRAPHIC      4
43cdf0e10cSrcweir #define SC_CONTENT_OLEOBJECT    5
44cdf0e10cSrcweir #define SC_CONTENT_NOTE         6
45cdf0e10cSrcweir #define SC_CONTENT_AREALINK     7
46cdf0e10cSrcweir #define SC_CONTENT_DRAWING      8
47cdf0e10cSrcweir #define SC_CONTENT_COUNT        9
48cdf0e10cSrcweir 
49cdf0e10cSrcweir const sal_uLong SC_CONTENT_NOCHILD  = ~0UL;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir //
52cdf0e10cSrcweir //  TreeListBox fuer Inhalte
53cdf0e10cSrcweir //
54cdf0e10cSrcweir 
55cdf0e10cSrcweir class ScContentTree : public SvTreeListBox
56cdf0e10cSrcweir {
57cdf0e10cSrcweir     ScNavigatorDlg*     pParentWindow;
58cdf0e10cSrcweir     ImageList           aEntryImages;
59cdf0e10cSrcweir     ImageList           aHCEntryImages;
60cdf0e10cSrcweir     SvLBoxEntry*        pRootNodes[SC_CONTENT_COUNT];
61cdf0e10cSrcweir     sal_uInt16              nRootType;          // als Root eingestellt
62cdf0e10cSrcweir     String              aManualDoc;         // im Navigator umgeschaltet (Title)
63cdf0e10cSrcweir     sal_Bool                bHiddenDoc;         // verstecktes aktiv?
64cdf0e10cSrcweir     String              aHiddenName;        // URL zum Laden
65cdf0e10cSrcweir     String              aHiddenTitle;       // fuer Anzeige
66cdf0e10cSrcweir     ScDocument*         pHiddenDocument;    // temporaer
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     sal_uInt16              pPosList[SC_CONTENT_COUNT];     // fuer die Reihenfolge
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     static sal_Bool bIsInDrag;      // static, falls der Navigator im ExecuteDrag geloescht wird
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     ScDocShell* GetManualOrCurrent();
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     void    InitRoot(sal_uInt16 nType);
75cdf0e10cSrcweir     void    ClearType(sal_uInt16 nType);
76cdf0e10cSrcweir     void    ClearAll();
77cdf0e10cSrcweir     void    InsertContent( sal_uInt16 nType, const String& rValue );
78cdf0e10cSrcweir     void    GetDrawNames( sal_uInt16 nType );
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     void    GetTableNames();
81cdf0e10cSrcweir     void    GetAreaNames();
82cdf0e10cSrcweir     void    GetDbNames();
83cdf0e10cSrcweir     void    GetLinkNames();
84cdf0e10cSrcweir     void    GetGraphicNames();
85cdf0e10cSrcweir     void    GetOleNames();
86cdf0e10cSrcweir     void    GetDrawingNames();
87cdf0e10cSrcweir     void    GetNoteStrings();
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     static bool IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     sal_Bool    DrawNamesChanged( sal_uInt16 nType );
92cdf0e10cSrcweir     sal_Bool    NoteStringsChanged();
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     ScAddress GetNotePos( sal_uLong nIndex );
95cdf0e10cSrcweir     const ScAreaLink* GetLink( sal_uLong nIndex );
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     /** Returns the indexes of the specified listbox entry.
98cdf0e10cSrcweir         @param rnRootIndex  Root index of specified entry is returned.
99cdf0e10cSrcweir         @param rnChildIndex  Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root).
100cdf0e10cSrcweir         @param pEntry  The entry to examine. */
101cdf0e10cSrcweir     void    GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvLBoxEntry* pEntry ) const;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     /** Returns the child index of the specified listbox entry.
104cdf0e10cSrcweir         @param pEntry  The entry to examine or NULL for the selected entry.
105cdf0e10cSrcweir         @return  Index of the entry inside its root or SC_CONTENT_NOCHILD if entry is root. */
106cdf0e10cSrcweir     sal_uLong   GetChildIndex( SvLBoxEntry* pEntry ) const;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     void    DoDrag();
109cdf0e10cSrcweir //UNUSED2008-05  void   AdjustTitle();
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     ScDocument* GetSourceDocument();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     DECL_LINK( ContentDoubleClickHdl, ScContentTree* );
114cdf0e10cSrcweir     DECL_STATIC_LINK( ScContentTree, ExecDragHdl, void* );
115cdf0e10cSrcweir 
116cdf0e10cSrcweir protected:
117cdf0e10cSrcweir //  virtual sal_Bool    Drop( const DropEvent& rEvt );
118cdf0e10cSrcweir //  virtual sal_Bool    QueryDrop( DropEvent& rEvt );
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     using SvTreeListBox::ExecuteDrop;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
123cdf0e10cSrcweir     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
124cdf0e10cSrcweir     virtual void        StartDrag( sal_Int8 nAction, const Point& rPosPixel );
125cdf0e10cSrcweir     virtual void        DragFinished( sal_Int8 nAction );
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     virtual void    Command( const CommandEvent& rCEvt );
128cdf0e10cSrcweir     virtual void    RequestHelp( const HelpEvent& rHEvt );
129cdf0e10cSrcweir 
130cdf0e10cSrcweir public:
131cdf0e10cSrcweir             ScContentTree( Window* pParent, const ResId& rResId );
132cdf0e10cSrcweir             ~ScContentTree();
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
135cdf0e10cSrcweir     virtual void    KeyInput( const KeyEvent& rKEvt );
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     void    InitWindowBits( sal_Bool bButtons );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     void    Refresh( sal_uInt16 nType = 0 );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     void    ToggleRoot();
142cdf0e10cSrcweir     void    SetRootType( sal_uInt16 nNew );
143cdf0e10cSrcweir     sal_uInt16  GetRootType() const             { return nRootType; }
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     void    ActiveDocChanged();
146cdf0e10cSrcweir     void    ResetManualDoc();
147cdf0e10cSrcweir     void    SetManualDoc(const String& rName);
148cdf0e10cSrcweir     sal_Bool    LoadFile(const String& rUrl);
149cdf0e10cSrcweir     void    SelectDoc(const String& rName);
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     const String& GetHiddenTitle() const    { return aHiddenTitle; }
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     /** Applies the navigator settings to the listbox. */
154cdf0e10cSrcweir     void                        ApplySettings();
155cdf0e10cSrcweir     /** Stores the current listbox state in the navigator settings. */
156cdf0e10cSrcweir     void                        StoreSettings() const;
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     static sal_Bool IsInDrag()  { return bIsInDrag; }
159cdf0e10cSrcweir };
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 
164cdf0e10cSrcweir #endif // SC_NAVIPI_HXX
165cdf0e10cSrcweir 
166