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