1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_NAMEDLG_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_NAMEDLG_HXX
23 #include <vcl/morebtn.hxx>
24 #include <vcl/combobox.hxx>
25 #include <vcl/group.hxx>
26 #include <vcl/fixed.hxx>
27 #include <vcl/lstbox.hxx>
29 #include "rangenam.hxx"
30 #include "anyrefdg.hxx"
31 #include "namemgrtable.hxx"
33 #include <boost/ptr_container/ptr_map.hpp>
34 #include <boost/ptr_container/ptr_set.hpp>
42 //logic behind the manage names dialog
43 class ScNameDlg
: public ScAnyRefDlg
, public ScRangeManagerTable::InitListener
46 VclPtr
<Edit
> m_pEdName
;
47 VclPtr
<formula::RefEdit
> m_pEdAssign
;
48 VclPtr
<formula::RefButton
> m_pRbAssign
;
49 VclPtr
<ListBox
> m_pLbScope
;
51 VclPtr
<CheckBox
> m_pBtnPrintArea
;
52 VclPtr
<CheckBox
> m_pBtnColHeader
;
53 VclPtr
<CheckBox
> m_pBtnCriteria
;
54 VclPtr
<CheckBox
> m_pBtnRowHeader
;
56 VclPtr
<PushButton
> m_pBtnAdd
;
57 VclPtr
<PushButton
> m_pBtnDelete
;
58 VclPtr
<PushButton
> m_pBtnOk
;
59 VclPtr
<PushButton
> m_pBtnCancel
;
61 VclPtr
<FixedText
> m_pFtInfo
;
63 VclPtr
<ScRangeManagerTable
> m_pRangeManagerTable
;
65 const OUString maGlobalNameStr
;
66 const OUString maErrInvalidNameStr
;
67 const OUString maErrNameInUse
;
68 const OUString maStrMultiSelect
;
69 OUString maStrInfoDefault
;
71 ScViewData
* mpViewData
;
73 const ScAddress maCursorPos
;
78 //ugly hack to call DefineNames from ManageNames
79 bool mbCloseWithoutUndo
;
81 typedef boost::ptr_map
<OUString
, ScRangeName
> RangeNameContainer
;
83 RangeNameContainer maRangeMap
;
87 void UpdateChecks(ScRangeData
* pData
);
88 void ShowOptions(const ScRangeNameLine
& rLine
);
92 bool IsFormulaValid();
93 void CheckForEmptyTable();
95 ScRangeName
* GetRangeName(const OUString
& rScope
);
105 void SelectionChanged();
108 DECL_LINK( OkBtnHdl
, void * );
109 DECL_LINK( CancelBtnHdl
, void * );
110 DECL_LINK( AddBtnHdl
, void * );
111 DECL_LINK( RemoveBtnHdl
, void * );
112 DECL_LINK( SelectBtnHdl
, void * );
113 DECL_LINK( EdModifyHdl
, void * );
114 DECL_LINK( AssignGetFocusHdl
, void * );
115 DECL_LINK( SelectionChangedHdl_Impl
, void* );
116 DECL_LINK( ScopeChangedHdl
, void* );
119 virtual void RefInputDone( bool bForced
= false ) SAL_OVERRIDE
;
122 ScNameDlg( SfxBindings
* pB
, SfxChildWindow
* pCW
, vcl::Window
* pParent
,
123 ScViewData
* ptrViewData
,
124 const ScAddress
& aCursorPos
, boost::ptr_map
<OUString
, ScRangeName
>* pRangeMap
= NULL
);
125 virtual ~ScNameDlg();
126 virtual void dispose() SAL_OVERRIDE
;
128 virtual void SetReference( const ScRange
& rRef
, ScDocument
* pDoc
) SAL_OVERRIDE
;
129 virtual bool IsRefInputMode() const SAL_OVERRIDE
;
131 virtual void SetActive() SAL_OVERRIDE
;
132 virtual bool Close() SAL_OVERRIDE
;
134 virtual void tableInitialized() SAL_OVERRIDE
;
136 void GetRangeNames(boost::ptr_map
<OUString
, ScRangeName
>& rRangeMap
);
137 void SetEntry(const OUString
& rName
, const OUString
& rScope
);
140 #endif // INCLUDED_SC_SOURCE_UI_INC_NAMEDLG_HXX
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */