xref: /trunk/main/sc/source/ui/inc/navipi.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
138d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
338d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
438d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
538d50f7bSAndrew Rist  * distributed with this work for additional information
638d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
738d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
838d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
938d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
1138d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
1338d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1438d50f7bSAndrew Rist  * software distributed under the License is distributed on an
1538d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1638d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
1738d50f7bSAndrew Rist  * specific language governing permissions and limitations
1838d50f7bSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
2038d50f7bSAndrew Rist  *************************************************************/
2138d50f7bSAndrew Rist 
2238d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_NAVIPI_HXX
25cdf0e10cSrcweir #define SC_NAVIPI_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vector>
28cdf0e10cSrcweir #include <vcl/toolbox.hxx>
29cdf0e10cSrcweir #include <vcl/field.hxx>
30cdf0e10cSrcweir #include <vcl/lstbox.hxx>
31cdf0e10cSrcweir #include <svtools/stdctrl.hxx>
32cdf0e10cSrcweir #include <svl/poolitem.hxx>
33cdf0e10cSrcweir #include <svl/lstner.hxx>
34cdf0e10cSrcweir #include <sfx2/childwin.hxx>
35cdf0e10cSrcweir #include "content.hxx"
36cdf0e10cSrcweir #include <svtools/svmedit.hxx>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class ScTabViewShell;
40cdf0e10cSrcweir class ScViewData;
41cdf0e10cSrcweir class ScArea;
42cdf0e10cSrcweir class ScScenarioWindow;
43cdf0e10cSrcweir class ScNavigatorControllerItem;
44cdf0e10cSrcweir class ScNavigatorDialogWrapper;
45cdf0e10cSrcweir class ScNavigatorDlg;
46cdf0e10cSrcweir class ScNavigatorSettings;
47cdf0e10cSrcweir class ScRange;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //========================================================================
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #define SC_DROPMODE_URL         0
52cdf0e10cSrcweir #define SC_DROPMODE_LINK        1
53cdf0e10cSrcweir #define SC_DROPMODE_COPY        2
54cdf0e10cSrcweir 
55cdf0e10cSrcweir enum NavListMode { NAV_LMODE_NONE       = 0x4000,
56cdf0e10cSrcweir                    NAV_LMODE_AREAS      = 0x2000,
57cdf0e10cSrcweir                    NAV_LMODE_DBAREAS    = 0x1000,
58cdf0e10cSrcweir                    NAV_LMODE_DOCS       = 0x800,
59cdf0e10cSrcweir                    NAV_LMODE_SCENARIOS  = 0x400 };
60cdf0e10cSrcweir 
61cdf0e10cSrcweir //========================================================================
62cdf0e10cSrcweir // class ScScenarioListBox -----------------------------------------------
63cdf0e10cSrcweir //========================================================================
64cdf0e10cSrcweir 
65cdf0e10cSrcweir class ScScenarioListBox : public ListBox
66cdf0e10cSrcweir {
67cdf0e10cSrcweir public:
68cdf0e10cSrcweir     explicit            ScScenarioListBox( ScScenarioWindow& rParent );
69cdf0e10cSrcweir     virtual             ~ScScenarioListBox();
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     void                UpdateEntries( List* pNewEntryList );
72cdf0e10cSrcweir 
73cdf0e10cSrcweir protected:
74cdf0e10cSrcweir     virtual void        Select();
75cdf0e10cSrcweir     virtual void        DoubleClick();
76cdf0e10cSrcweir     virtual long        Notify( NotifyEvent& rNEvt );
77cdf0e10cSrcweir 
78cdf0e10cSrcweir private:
79cdf0e10cSrcweir     struct ScenarioEntry
80cdf0e10cSrcweir     {
81cdf0e10cSrcweir         String              maName;
82cdf0e10cSrcweir         String              maComment;
83cdf0e10cSrcweir         bool                mbProtected;
84cdf0e10cSrcweir 
ScenarioEntryScScenarioListBox::ScenarioEntry85cdf0e10cSrcweir         inline explicit     ScenarioEntry() : mbProtected( false ) {}
86cdf0e10cSrcweir     };
87cdf0e10cSrcweir     typedef ::std::vector< ScenarioEntry > ScenarioList;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir private:
90cdf0e10cSrcweir     const ScenarioEntry* GetSelectedEntry() const;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     void                ExecuteScenarioSlot( sal_uInt16 nSlotId );
93cdf0e10cSrcweir     void                SelectScenario();
94cdf0e10cSrcweir     void                EditScenario();
95cdf0e10cSrcweir     void                DeleteScenario( bool bQueryBox );
96cdf0e10cSrcweir 
97cdf0e10cSrcweir private:
98cdf0e10cSrcweir     ScScenarioWindow&   mrParent;
99cdf0e10cSrcweir     ScenarioList        maEntries;
100cdf0e10cSrcweir };
101cdf0e10cSrcweir 
102cdf0e10cSrcweir //========================================================================
103cdf0e10cSrcweir // class ScScenarioWindow ------------------------------------------------
104cdf0e10cSrcweir //========================================================================
105cdf0e10cSrcweir class ScScenarioWindow : public Window
106cdf0e10cSrcweir {
107cdf0e10cSrcweir public:
108cdf0e10cSrcweir             ScScenarioWindow( Window* pParent,const String& aQH_List,const String& aQH_Comment);
109cdf0e10cSrcweir             ~ScScenarioWindow();
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     void    NotifyState( const SfxPoolItem* pState );
SetComment(const String & rComment)112cdf0e10cSrcweir     void    SetComment( const String& rComment )
113cdf0e10cSrcweir                 { aEdComment.SetText( rComment ); }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     void    SetSizePixel( const Size& rNewSize );
116cdf0e10cSrcweir 
117cdf0e10cSrcweir protected:
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRec );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir private:
122cdf0e10cSrcweir     ScScenarioListBox   aLbScenario;
123cdf0e10cSrcweir     MultiLineEdit       aEdComment;
124cdf0e10cSrcweir };
125cdf0e10cSrcweir 
126cdf0e10cSrcweir //==================================================================
127cdf0e10cSrcweir //  class ColumnEdit
128cdf0e10cSrcweir //==================================================================
129cdf0e10cSrcweir class ColumnEdit : public SpinField
130cdf0e10cSrcweir {
131cdf0e10cSrcweir public:
132cdf0e10cSrcweir             ColumnEdit( ScNavigatorDlg* pParent, const ResId& rResId );
133cdf0e10cSrcweir             ~ColumnEdit();
134cdf0e10cSrcweir 
GetCol()135cdf0e10cSrcweir     SCCOL   GetCol() { return nCol; }
136cdf0e10cSrcweir     void    SetCol( SCCOL nColNo );
137cdf0e10cSrcweir 
138cdf0e10cSrcweir protected:
139cdf0e10cSrcweir     virtual long    Notify( NotifyEvent& rNEvt );
140cdf0e10cSrcweir     virtual void    LoseFocus();
141cdf0e10cSrcweir     virtual void    Up();
142cdf0e10cSrcweir     virtual void    Down();
143cdf0e10cSrcweir     virtual void    First();
144cdf0e10cSrcweir     virtual void    Last();
145cdf0e10cSrcweir 
146cdf0e10cSrcweir private:
147cdf0e10cSrcweir     ScNavigatorDlg& rDlg;
148cdf0e10cSrcweir     SCCOL           nCol;
149cdf0e10cSrcweir     sal_uInt16          nKeyGroup;
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     void    EvalText        ();
152cdf0e10cSrcweir     void    ExecuteCol      ();
153cdf0e10cSrcweir     SCCOL   AlphaToNum      ( String& rStr );
154cdf0e10cSrcweir     SCCOL   NumStrToAlpha   ( String& rStr );
155cdf0e10cSrcweir     SCCOL   NumToAlpha      ( SCCOL nColNo, String& rStr );
156cdf0e10cSrcweir };
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 
159cdf0e10cSrcweir //==================================================================
160cdf0e10cSrcweir //  class RowEdit
161cdf0e10cSrcweir //==================================================================
162cdf0e10cSrcweir class RowEdit : public NumericField
163cdf0e10cSrcweir {
164cdf0e10cSrcweir public:
165cdf0e10cSrcweir             RowEdit( ScNavigatorDlg* pParent, const ResId& rResId );
166cdf0e10cSrcweir             ~RowEdit();
167cdf0e10cSrcweir 
GetRow()168cdf0e10cSrcweir     SCROW   GetRow()                { return (SCROW)GetValue(); }
SetRow(SCROW nRow)169cdf0e10cSrcweir     void    SetRow( SCROW nRow ){ SetValue( nRow ); }
170cdf0e10cSrcweir 
171cdf0e10cSrcweir protected:
172cdf0e10cSrcweir     virtual long    Notify( NotifyEvent& rNEvt );
173cdf0e10cSrcweir     virtual void    LoseFocus();
174cdf0e10cSrcweir 
175cdf0e10cSrcweir private:
176cdf0e10cSrcweir     ScNavigatorDlg& rDlg;
177cdf0e10cSrcweir 
178cdf0e10cSrcweir     void    ExecuteRow();
179cdf0e10cSrcweir };
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 
182cdf0e10cSrcweir //==================================================================
183cdf0e10cSrcweir //  class ScDocListBox
184cdf0e10cSrcweir //==================================================================
185cdf0e10cSrcweir class ScDocListBox : public ListBox
186cdf0e10cSrcweir {
187cdf0e10cSrcweir public:
188cdf0e10cSrcweir             ScDocListBox( ScNavigatorDlg* pParent, const ResId& rResId );
189cdf0e10cSrcweir             ~ScDocListBox();
190cdf0e10cSrcweir 
191cdf0e10cSrcweir protected:
192cdf0e10cSrcweir     virtual void    Select();
193cdf0e10cSrcweir 
194cdf0e10cSrcweir private:
195cdf0e10cSrcweir     ScNavigatorDlg& rDlg;
196cdf0e10cSrcweir };
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 
199cdf0e10cSrcweir //==================================================================
200cdf0e10cSrcweir //  class CommandToolBox
201cdf0e10cSrcweir //==================================================================
202cdf0e10cSrcweir class CommandToolBox : public ToolBox
203cdf0e10cSrcweir {
204cdf0e10cSrcweir public:
205cdf0e10cSrcweir             CommandToolBox( ScNavigatorDlg* pParent, const ResId& rResId );
206cdf0e10cSrcweir             ~CommandToolBox();
207cdf0e10cSrcweir 
208cdf0e10cSrcweir     void Select( sal_uInt16 nId );
209cdf0e10cSrcweir     void UpdateButtons();
210cdf0e10cSrcweir     void InitImageList();
211cdf0e10cSrcweir 
212cdf0e10cSrcweir     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
213cdf0e10cSrcweir 
214cdf0e10cSrcweir     DECL_LINK( ToolBoxDropdownClickHdl, ToolBox* );
215cdf0e10cSrcweir 
216cdf0e10cSrcweir protected:
217cdf0e10cSrcweir     virtual void    Select();
218cdf0e10cSrcweir     virtual void    Click();
219cdf0e10cSrcweir 
220cdf0e10cSrcweir private:
221cdf0e10cSrcweir     ScNavigatorDlg& rDlg;
222cdf0e10cSrcweir };
223cdf0e10cSrcweir 
224cdf0e10cSrcweir //==================================================================
225cdf0e10cSrcweir //  class ScNavigatorDlg
226cdf0e10cSrcweir //==================================================================
227cdf0e10cSrcweir 
228cdf0e10cSrcweir class ScNavigatorDlg : public Window, public SfxListener
229cdf0e10cSrcweir {
230cdf0e10cSrcweir friend class ScNavigatorControllerItem;
231cdf0e10cSrcweir friend class ScNavigatorDialogWrapper;
232cdf0e10cSrcweir friend class ColumnEdit;
233cdf0e10cSrcweir friend class RowEdit;
234cdf0e10cSrcweir friend class ScDocListBox;
235cdf0e10cSrcweir friend class CommandToolBox;
236cdf0e10cSrcweir friend class ScContentTree;
237cdf0e10cSrcweir 
238cdf0e10cSrcweir private:
239cdf0e10cSrcweir     SfxBindings&        rBindings;      // must be first member
240cdf0e10cSrcweir 
241cdf0e10cSrcweir     ImageList           aCmdImageList;  // must be before aTbxCmd
242cdf0e10cSrcweir     ImageList           aCmdImageListH;
243cdf0e10cSrcweir     FixedInfo           aFtCol;
244cdf0e10cSrcweir     ColumnEdit          aEdCol;
245cdf0e10cSrcweir     FixedInfo           aFtRow;
246cdf0e10cSrcweir     RowEdit             aEdRow;
247cdf0e10cSrcweir     CommandToolBox      aTbxCmd;
248cdf0e10cSrcweir     ScContentTree       aLbEntries;
249cdf0e10cSrcweir     ScScenarioWindow    aWndScenarios;
250cdf0e10cSrcweir     ScDocListBox        aLbDocuments;
251cdf0e10cSrcweir 
252cdf0e10cSrcweir     Timer           aContentTimer;
253cdf0e10cSrcweir 
254cdf0e10cSrcweir     String          aTitleBase;
255cdf0e10cSrcweir     String          aStrDragMode;
256cdf0e10cSrcweir     String          aStrDisplay;
257cdf0e10cSrcweir     String          aStrActive;
258cdf0e10cSrcweir     String          aStrNotActive;
259cdf0e10cSrcweir     String          aStrHidden;
260cdf0e10cSrcweir     String          aStrActiveWin;
261cdf0e10cSrcweir 
262cdf0e10cSrcweir     SfxChildWindowContext*  pContextWin;
263cdf0e10cSrcweir     Size                    aInitSize;
264cdf0e10cSrcweir     ScArea*                 pMarkArea;
265cdf0e10cSrcweir     ScViewData*             pViewData;
266cdf0e10cSrcweir 
267cdf0e10cSrcweir     long            nBorderOffset;
268cdf0e10cSrcweir     long            nListModeHeight;
269cdf0e10cSrcweir     long            nInitListHeight;
270cdf0e10cSrcweir     NavListMode     eListMode;
271cdf0e10cSrcweir     sal_uInt16          nDropMode;
272cdf0e10cSrcweir     SCCOL           nCurCol;
273cdf0e10cSrcweir     SCROW           nCurRow;
274cdf0e10cSrcweir     SCTAB           nCurTab;
275cdf0e10cSrcweir     sal_Bool            bFirstBig;
276*37fee4fdSAndre Fischer     bool mbUseStyleSettingsBackground;
277cdf0e10cSrcweir 
278cdf0e10cSrcweir     ScNavigatorControllerItem** ppBoundItems;
279cdf0e10cSrcweir 
280cdf0e10cSrcweir     DECL_LINK( TimeHdl, Timer* );
281cdf0e10cSrcweir 
282cdf0e10cSrcweir     void    DoResize();
283cdf0e10cSrcweir 
GetBindings()284cdf0e10cSrcweir     SfxBindings&    GetBindings()
285cdf0e10cSrcweir                     { return rBindings; }
286cdf0e10cSrcweir 
287cdf0e10cSrcweir     void    SetCurrentCell( SCCOL nCol, SCROW Row );
288cdf0e10cSrcweir     void    SetCurrentCellStr( const String rName );
289cdf0e10cSrcweir     void    SetCurrentTable( SCTAB nTab );
290cdf0e10cSrcweir     void    SetCurrentTableStr( const String rName );
291cdf0e10cSrcweir     void    SetCurrentObject( const String rName );
292cdf0e10cSrcweir     void    SetCurrentDoc( const String& rDocName );
293cdf0e10cSrcweir 
294cdf0e10cSrcweir     ScTabViewShell*         GetTabViewShell() const;
295cdf0e10cSrcweir     ScNavigatorSettings*    GetNavigatorSettings();
296cdf0e10cSrcweir     sal_Bool                    GetViewData();
297cdf0e10cSrcweir 
298cdf0e10cSrcweir     void    UpdateColumn    ( const SCCOL* pCol = NULL );
299cdf0e10cSrcweir     void    UpdateRow       ( const SCROW* pRow = NULL );
300cdf0e10cSrcweir     void    UpdateTable     ( const SCTAB* pTab = NULL );
301cdf0e10cSrcweir     void    UpdateAll       ();
302cdf0e10cSrcweir 
303cdf0e10cSrcweir     void    GetDocNames(const String* pSelEntry = NULL);
304cdf0e10cSrcweir 
305cdf0e10cSrcweir     void    SetListMode     ( NavListMode eMode, sal_Bool bSetSize = sal_True );
306cdf0e10cSrcweir     void    ShowList        ( sal_Bool bShow, sal_Bool bSetSize );
307cdf0e10cSrcweir     void    ShowScenarios   ( sal_Bool bShow, sal_Bool bSetSize );
308cdf0e10cSrcweir 
309cdf0e10cSrcweir     void    SetDropMode(sal_uInt16 nNew);
GetDropMode() const310cdf0e10cSrcweir     sal_uInt16  GetDropMode() const         { return nDropMode; }
311cdf0e10cSrcweir 
GetStrDragMode() const312cdf0e10cSrcweir     const String& GetStrDragMode() const    { return aStrDragMode; }
GetStrDisplay() const313cdf0e10cSrcweir     const String& GetStrDisplay() const     { return aStrDisplay; }
314cdf0e10cSrcweir 
315cdf0e10cSrcweir     void    CheckDataArea   ();
316cdf0e10cSrcweir     void    MarkDataArea    ();
317cdf0e10cSrcweir     void    UnmarkDataArea  ();
318cdf0e10cSrcweir     void    StartOfDataArea ();
319cdf0e10cSrcweir     void    EndOfDataArea   ();
320cdf0e10cSrcweir 
321cdf0e10cSrcweir     static void ReleaseFocus();
322cdf0e10cSrcweir 
323cdf0e10cSrcweir protected:
324cdf0e10cSrcweir     virtual void    Resize();
325cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRec );
326cdf0e10cSrcweir     virtual void    Resizing( Size& rSize );
327cdf0e10cSrcweir 
328cdf0e10cSrcweir public:
329*37fee4fdSAndre Fischer                 ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent,
330*37fee4fdSAndre Fischer                     const bool bUseStyleSettingsBackground);
331cdf0e10cSrcweir                 ~ScNavigatorDlg();
332cdf0e10cSrcweir 
333cdf0e10cSrcweir     using Window::Notify;
334cdf0e10cSrcweir     virtual void    Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
335cdf0e10cSrcweir 
336cdf0e10cSrcweir     void            CursorPosChanged();
337cdf0e10cSrcweir 
338cdf0e10cSrcweir     virtual SfxChildAlignment
339cdf0e10cSrcweir                     CheckAlignment(SfxChildAlignment,SfxChildAlignment);
340cdf0e10cSrcweir     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
341cdf0e10cSrcweir };
342cdf0e10cSrcweir 
343cdf0e10cSrcweir //==================================================================
344cdf0e10cSrcweir 
345cdf0e10cSrcweir class ScNavigatorDialogWrapper: public SfxChildWindowContext
346cdf0e10cSrcweir {
347cdf0e10cSrcweir public:
348cdf0e10cSrcweir             ScNavigatorDialogWrapper( Window*           pParent,
349cdf0e10cSrcweir                                       sal_uInt16            nId,
350cdf0e10cSrcweir                                       SfxBindings*      pBindings,
351cdf0e10cSrcweir                                       SfxChildWinInfo*  pInfo );
352cdf0e10cSrcweir 
353cdf0e10cSrcweir     SFX_DECL_CHILDWINDOWCONTEXT(ScNavigatorDialogWrapper)
354cdf0e10cSrcweir 
355cdf0e10cSrcweir     virtual void    Resizing( Size& rSize );
356cdf0e10cSrcweir 
357cdf0e10cSrcweir private:
358cdf0e10cSrcweir     ScNavigatorDlg* pNavigator;
359cdf0e10cSrcweir };
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 
363cdf0e10cSrcweir #endif // SC_NAVIPI_HXX
364