xref: /trunk/main/sc/source/ui/inc/navipi.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef SC_NAVIPI_HXX
29*cdf0e10cSrcweir #define SC_NAVIPI_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <vector>
32*cdf0e10cSrcweir #include <vcl/toolbox.hxx>
33*cdf0e10cSrcweir #include <vcl/field.hxx>
34*cdf0e10cSrcweir #include <vcl/lstbox.hxx>
35*cdf0e10cSrcweir #include <svtools/stdctrl.hxx>
36*cdf0e10cSrcweir #include <svl/poolitem.hxx>
37*cdf0e10cSrcweir #include <svl/lstner.hxx>
38*cdf0e10cSrcweir #include <sfx2/childwin.hxx>
39*cdf0e10cSrcweir #include "content.hxx"
40*cdf0e10cSrcweir #include <svtools/svmedit.hxx>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir class ScTabViewShell;
44*cdf0e10cSrcweir class ScViewData;
45*cdf0e10cSrcweir class ScArea;
46*cdf0e10cSrcweir class ScScenarioWindow;
47*cdf0e10cSrcweir class ScNavigatorControllerItem;
48*cdf0e10cSrcweir class ScNavigatorDialogWrapper;
49*cdf0e10cSrcweir class ScNavigatorDlg;
50*cdf0e10cSrcweir class ScNavigatorSettings;
51*cdf0e10cSrcweir class ScRange;
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir //========================================================================
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir #define SC_DROPMODE_URL         0
56*cdf0e10cSrcweir #define SC_DROPMODE_LINK        1
57*cdf0e10cSrcweir #define SC_DROPMODE_COPY        2
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir enum NavListMode { NAV_LMODE_NONE       = 0x4000,
60*cdf0e10cSrcweir                    NAV_LMODE_AREAS      = 0x2000,
61*cdf0e10cSrcweir                    NAV_LMODE_DBAREAS    = 0x1000,
62*cdf0e10cSrcweir                    NAV_LMODE_DOCS       = 0x800,
63*cdf0e10cSrcweir                    NAV_LMODE_SCENARIOS  = 0x400 };
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir //========================================================================
66*cdf0e10cSrcweir // class ScScenarioListBox -----------------------------------------------
67*cdf0e10cSrcweir //========================================================================
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir class ScScenarioListBox : public ListBox
70*cdf0e10cSrcweir {
71*cdf0e10cSrcweir public:
72*cdf0e10cSrcweir     explicit            ScScenarioListBox( ScScenarioWindow& rParent );
73*cdf0e10cSrcweir     virtual             ~ScScenarioListBox();
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir     void                UpdateEntries( List* pNewEntryList );
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir protected:
78*cdf0e10cSrcweir     virtual void        Select();
79*cdf0e10cSrcweir     virtual void        DoubleClick();
80*cdf0e10cSrcweir     virtual long        Notify( NotifyEvent& rNEvt );
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir private:
83*cdf0e10cSrcweir     struct ScenarioEntry
84*cdf0e10cSrcweir     {
85*cdf0e10cSrcweir         String              maName;
86*cdf0e10cSrcweir         String              maComment;
87*cdf0e10cSrcweir         bool                mbProtected;
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir         inline explicit     ScenarioEntry() : mbProtected( false ) {}
90*cdf0e10cSrcweir     };
91*cdf0e10cSrcweir     typedef ::std::vector< ScenarioEntry > ScenarioList;
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir private:
94*cdf0e10cSrcweir     const ScenarioEntry* GetSelectedEntry() const;
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir     void                ExecuteScenarioSlot( sal_uInt16 nSlotId );
97*cdf0e10cSrcweir     void                SelectScenario();
98*cdf0e10cSrcweir     void                EditScenario();
99*cdf0e10cSrcweir     void                DeleteScenario( bool bQueryBox );
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir private:
102*cdf0e10cSrcweir     ScScenarioWindow&   mrParent;
103*cdf0e10cSrcweir     ScenarioList        maEntries;
104*cdf0e10cSrcweir };
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir //========================================================================
107*cdf0e10cSrcweir // class ScScenarioWindow ------------------------------------------------
108*cdf0e10cSrcweir //========================================================================
109*cdf0e10cSrcweir class ScScenarioWindow : public Window
110*cdf0e10cSrcweir {
111*cdf0e10cSrcweir public:
112*cdf0e10cSrcweir             ScScenarioWindow( Window* pParent,const String& aQH_List,const String& aQH_Comment);
113*cdf0e10cSrcweir             ~ScScenarioWindow();
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     void    NotifyState( const SfxPoolItem* pState );
116*cdf0e10cSrcweir     void    SetComment( const String& rComment )
117*cdf0e10cSrcweir                 { aEdComment.SetText( rComment ); }
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir     void    SetSizePixel( const Size& rNewSize );
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir protected:
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRec );
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir private:
126*cdf0e10cSrcweir     ScScenarioListBox   aLbScenario;
127*cdf0e10cSrcweir     MultiLineEdit       aEdComment;
128*cdf0e10cSrcweir };
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir //==================================================================
131*cdf0e10cSrcweir //  class ColumnEdit
132*cdf0e10cSrcweir //==================================================================
133*cdf0e10cSrcweir class ColumnEdit : public SpinField
134*cdf0e10cSrcweir {
135*cdf0e10cSrcweir public:
136*cdf0e10cSrcweir             ColumnEdit( ScNavigatorDlg* pParent, const ResId& rResId );
137*cdf0e10cSrcweir             ~ColumnEdit();
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir     SCCOL   GetCol() { return nCol; }
140*cdf0e10cSrcweir     void    SetCol( SCCOL nColNo );
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir protected:
143*cdf0e10cSrcweir     virtual long    Notify( NotifyEvent& rNEvt );
144*cdf0e10cSrcweir     virtual void    LoseFocus();
145*cdf0e10cSrcweir     virtual void    Up();
146*cdf0e10cSrcweir     virtual void    Down();
147*cdf0e10cSrcweir     virtual void    First();
148*cdf0e10cSrcweir     virtual void    Last();
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir private:
151*cdf0e10cSrcweir     ScNavigatorDlg& rDlg;
152*cdf0e10cSrcweir     SCCOL           nCol;
153*cdf0e10cSrcweir     sal_uInt16          nKeyGroup;
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir     void    EvalText        ();
156*cdf0e10cSrcweir     void    ExecuteCol      ();
157*cdf0e10cSrcweir     SCCOL   AlphaToNum      ( String& rStr );
158*cdf0e10cSrcweir     SCCOL   NumStrToAlpha   ( String& rStr );
159*cdf0e10cSrcweir     SCCOL   NumToAlpha      ( SCCOL nColNo, String& rStr );
160*cdf0e10cSrcweir };
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir //==================================================================
164*cdf0e10cSrcweir //  class RowEdit
165*cdf0e10cSrcweir //==================================================================
166*cdf0e10cSrcweir class RowEdit : public NumericField
167*cdf0e10cSrcweir {
168*cdf0e10cSrcweir public:
169*cdf0e10cSrcweir             RowEdit( ScNavigatorDlg* pParent, const ResId& rResId );
170*cdf0e10cSrcweir             ~RowEdit();
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir     SCROW   GetRow()                { return (SCROW)GetValue(); }
173*cdf0e10cSrcweir     void    SetRow( SCROW nRow ){ SetValue( nRow ); }
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir protected:
176*cdf0e10cSrcweir     virtual long    Notify( NotifyEvent& rNEvt );
177*cdf0e10cSrcweir     virtual void    LoseFocus();
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir private:
180*cdf0e10cSrcweir     ScNavigatorDlg& rDlg;
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir     void    ExecuteRow();
183*cdf0e10cSrcweir };
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir //==================================================================
187*cdf0e10cSrcweir //  class ScDocListBox
188*cdf0e10cSrcweir //==================================================================
189*cdf0e10cSrcweir class ScDocListBox : public ListBox
190*cdf0e10cSrcweir {
191*cdf0e10cSrcweir public:
192*cdf0e10cSrcweir             ScDocListBox( ScNavigatorDlg* pParent, const ResId& rResId );
193*cdf0e10cSrcweir             ~ScDocListBox();
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir protected:
196*cdf0e10cSrcweir     virtual void    Select();
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir private:
199*cdf0e10cSrcweir     ScNavigatorDlg& rDlg;
200*cdf0e10cSrcweir };
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir //==================================================================
204*cdf0e10cSrcweir //  class CommandToolBox
205*cdf0e10cSrcweir //==================================================================
206*cdf0e10cSrcweir class CommandToolBox : public ToolBox
207*cdf0e10cSrcweir {
208*cdf0e10cSrcweir public:
209*cdf0e10cSrcweir             CommandToolBox( ScNavigatorDlg* pParent, const ResId& rResId );
210*cdf0e10cSrcweir             ~CommandToolBox();
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir     void Select( sal_uInt16 nId );
213*cdf0e10cSrcweir     void UpdateButtons();
214*cdf0e10cSrcweir     void InitImageList();
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir     DECL_LINK( ToolBoxDropdownClickHdl, ToolBox* );
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir protected:
221*cdf0e10cSrcweir     virtual void    Select();
222*cdf0e10cSrcweir     virtual void    Click();
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir private:
225*cdf0e10cSrcweir     ScNavigatorDlg& rDlg;
226*cdf0e10cSrcweir };
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir //==================================================================
229*cdf0e10cSrcweir //  class ScNavigatorDlg
230*cdf0e10cSrcweir //==================================================================
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir class ScNavigatorDlg : public Window, public SfxListener
233*cdf0e10cSrcweir {
234*cdf0e10cSrcweir friend class ScNavigatorControllerItem;
235*cdf0e10cSrcweir friend class ScNavigatorDialogWrapper;
236*cdf0e10cSrcweir friend class ColumnEdit;
237*cdf0e10cSrcweir friend class RowEdit;
238*cdf0e10cSrcweir friend class ScDocListBox;
239*cdf0e10cSrcweir friend class CommandToolBox;
240*cdf0e10cSrcweir friend class ScContentTree;
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir private:
243*cdf0e10cSrcweir     SfxBindings&        rBindings;      // must be first member
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir     ImageList           aCmdImageList;  // must be before aTbxCmd
246*cdf0e10cSrcweir     ImageList           aCmdImageListH;
247*cdf0e10cSrcweir     FixedInfo           aFtCol;
248*cdf0e10cSrcweir     ColumnEdit          aEdCol;
249*cdf0e10cSrcweir     FixedInfo           aFtRow;
250*cdf0e10cSrcweir     RowEdit             aEdRow;
251*cdf0e10cSrcweir     CommandToolBox      aTbxCmd;
252*cdf0e10cSrcweir     ScContentTree       aLbEntries;
253*cdf0e10cSrcweir     ScScenarioWindow    aWndScenarios;
254*cdf0e10cSrcweir     ScDocListBox        aLbDocuments;
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir     Timer           aContentTimer;
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir     String          aTitleBase;
259*cdf0e10cSrcweir     String          aStrDragMode;
260*cdf0e10cSrcweir     String          aStrDisplay;
261*cdf0e10cSrcweir     String          aStrActive;
262*cdf0e10cSrcweir     String          aStrNotActive;
263*cdf0e10cSrcweir     String          aStrHidden;
264*cdf0e10cSrcweir     String          aStrActiveWin;
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir     SfxChildWindowContext*  pContextWin;
267*cdf0e10cSrcweir     Size                    aInitSize;
268*cdf0e10cSrcweir     ScArea*                 pMarkArea;
269*cdf0e10cSrcweir     ScViewData*             pViewData;
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir     long            nBorderOffset;
272*cdf0e10cSrcweir     long            nListModeHeight;
273*cdf0e10cSrcweir     long            nInitListHeight;
274*cdf0e10cSrcweir     NavListMode     eListMode;
275*cdf0e10cSrcweir     sal_uInt16          nDropMode;
276*cdf0e10cSrcweir     SCCOL           nCurCol;
277*cdf0e10cSrcweir     SCROW           nCurRow;
278*cdf0e10cSrcweir     SCTAB           nCurTab;
279*cdf0e10cSrcweir     sal_Bool            bFirstBig;
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir     ScNavigatorControllerItem** ppBoundItems;
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir     DECL_LINK( TimeHdl, Timer* );
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir     void    DoResize();
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir     SfxBindings&    GetBindings()
288*cdf0e10cSrcweir                     { return rBindings; }
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir     void    SetCurrentCell( SCCOL nCol, SCROW Row );
291*cdf0e10cSrcweir     void    SetCurrentCellStr( const String rName );
292*cdf0e10cSrcweir     void    SetCurrentTable( SCTAB nTab );
293*cdf0e10cSrcweir     void    SetCurrentTableStr( const String rName );
294*cdf0e10cSrcweir     void    SetCurrentObject( const String rName );
295*cdf0e10cSrcweir     void    SetCurrentDoc( const String& rDocName );
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir     ScTabViewShell*         GetTabViewShell() const;
298*cdf0e10cSrcweir     ScNavigatorSettings*    GetNavigatorSettings();
299*cdf0e10cSrcweir     sal_Bool                    GetViewData();
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir     void    UpdateColumn    ( const SCCOL* pCol = NULL );
302*cdf0e10cSrcweir     void    UpdateRow       ( const SCROW* pRow = NULL );
303*cdf0e10cSrcweir     void    UpdateTable     ( const SCTAB* pTab = NULL );
304*cdf0e10cSrcweir     void    UpdateAll       ();
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir     void    GetDocNames(const String* pSelEntry = NULL);
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir     void    SetListMode     ( NavListMode eMode, sal_Bool bSetSize = sal_True );
309*cdf0e10cSrcweir     void    ShowList        ( sal_Bool bShow, sal_Bool bSetSize );
310*cdf0e10cSrcweir     void    ShowScenarios   ( sal_Bool bShow, sal_Bool bSetSize );
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir     void    SetDropMode(sal_uInt16 nNew);
313*cdf0e10cSrcweir     sal_uInt16  GetDropMode() const         { return nDropMode; }
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir     const String& GetStrDragMode() const    { return aStrDragMode; }
316*cdf0e10cSrcweir     const String& GetStrDisplay() const     { return aStrDisplay; }
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir     void    CheckDataArea   ();
319*cdf0e10cSrcweir     void    MarkDataArea    ();
320*cdf0e10cSrcweir     void    UnmarkDataArea  ();
321*cdf0e10cSrcweir     void    StartOfDataArea ();
322*cdf0e10cSrcweir     void    EndOfDataArea   ();
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir     static void ReleaseFocus();
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir protected:
327*cdf0e10cSrcweir     virtual void    Resize();
328*cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRec );
329*cdf0e10cSrcweir     virtual void    Resizing( Size& rSize );
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir public:
332*cdf0e10cSrcweir                 ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent );
333*cdf0e10cSrcweir                 ~ScNavigatorDlg();
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir     using Window::Notify;
336*cdf0e10cSrcweir     virtual void    Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir     void            CursorPosChanged();
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir     virtual SfxChildAlignment
341*cdf0e10cSrcweir                     CheckAlignment(SfxChildAlignment,SfxChildAlignment);
342*cdf0e10cSrcweir     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
343*cdf0e10cSrcweir };
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir //==================================================================
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir class ScNavigatorDialogWrapper: public SfxChildWindowContext
348*cdf0e10cSrcweir {
349*cdf0e10cSrcweir public:
350*cdf0e10cSrcweir             ScNavigatorDialogWrapper( Window*           pParent,
351*cdf0e10cSrcweir                                       sal_uInt16            nId,
352*cdf0e10cSrcweir                                       SfxBindings*      pBindings,
353*cdf0e10cSrcweir                                       SfxChildWinInfo*  pInfo );
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir     SFX_DECL_CHILDWINDOWCONTEXT(ScNavigatorDialogWrapper)
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir     virtual void    Resizing( Size& rSize );
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir private:
360*cdf0e10cSrcweir     ScNavigatorDlg* pNavigator;
361*cdf0e10cSrcweir };
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir #endif // SC_NAVIPI_HXX
366*cdf0e10cSrcweir 
367