1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: navicfg.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <swtypes.hxx> // fuer Pathfinder
36 #include <navicfg.hxx>
38 #include <tools/debug.hxx>
39 #include <com/sun/star/uno/Any.hxx>
40 #include <com/sun/star/uno/Sequence.hxx>
44 using namespace ::utl
;
45 using namespace ::rtl
;
46 using namespace ::com::sun::star::uno
;
48 /* -----------------------------08.09.00 16:30--------------------------------
50 ---------------------------------------------------------------------------*/
51 Sequence
<OUString
> SwNavigationConfig::GetPropertyNames()
53 static const char* aPropNames
[] =
56 "SelectedPosition", //1
64 Sequence
<OUString
> aNames(nCount
);
65 OUString
* pNames
= aNames
.getArray();
66 for(int i
= 0; i
< nCount
; i
++)
68 pNames
[i
] = OUString::createFromAscii(aPropNames
[i
]);
72 /*-----------------13.11.96 11.03-------------------
74 --------------------------------------------------*/
76 SwNavigationConfig::SwNavigationConfig() :
77 utl::ConfigItem(C2U("Office.Writer/Navigator")),
80 nOutlineLevel(MAXLEVEL
),
81 nRegionMode(REGION_MODE_NONE
),
86 Sequence
<OUString
> aNames
= GetPropertyNames();
87 Sequence
<Any
> aValues
= GetProperties(aNames
);
88 // EnableNotification(aNames);
89 const Any
* pValues
= aValues
.getConstArray();
90 DBG_ASSERT(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
91 if(aValues
.getLength() == aNames
.getLength())
93 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
95 if(pValues
[nProp
].hasValue())
99 case 0: pValues
[nProp
] >>= nRootType
; break;
100 case 1: pValues
[nProp
] >>= nSelectedPos
; break;
101 case 2: pValues
[nProp
] >>= nOutlineLevel
; break;
102 case 3: pValues
[nProp
] >>= nRegionMode
; break;
103 case 4: pValues
[nProp
] >>= nActiveBlock
; break;
104 case 5: bIsSmall
= *(sal_Bool
*)pValues
[nProp
].getValue(); break;
105 case 6: bIsGlobalActive
= *(sal_Bool
*)pValues
[nProp
].getValue(); break;
111 /* -----------------------------08.09.00 16:35--------------------------------
113 ---------------------------------------------------------------------------*/
114 SwNavigationConfig::~SwNavigationConfig()
116 /* -----------------------------08.09.00 16:35--------------------------------
118 ---------------------------------------------------------------------------*/
119 void SwNavigationConfig::Commit()
121 Sequence
<OUString
> aNames
= GetPropertyNames();
122 Sequence
<Any
> aValues(aNames
.getLength());
123 Any
* pValues
= aValues
.getArray();
124 const Type
& rType
= ::getBooleanCppuType();
126 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
130 case 0: pValues
[nProp
] <<= nRootType
; break;
131 case 1: pValues
[nProp
] <<= nSelectedPos
; break;
132 case 2: pValues
[nProp
] <<= nOutlineLevel
; break;
133 case 3: pValues
[nProp
] <<= nRegionMode
; break;
134 case 4: pValues
[nProp
] <<= nActiveBlock
; break;
135 case 5: pValues
[nProp
].setValue(&bIsSmall
, rType
); break;
136 case 6: pValues
[nProp
].setValue(&bIsGlobalActive
, rType
); break;
139 PutProperties(aNames
, aValues
);