Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #include <sfx2/sfxsids.hrc>
22 : #include "sorgitm.hxx"
23 : // STATIC DATA -----------------------------------------------------------
24 :
25 22 : TYPEINIT1_AUTOFACTORY(SfxScriptOrganizerItem, SfxStringItem);
26 :
27 : //------------------------------------------------------------------------
28 :
29 0 : SfxScriptOrganizerItem::SfxScriptOrganizerItem() :
30 :
31 0 : SfxStringItem()
32 :
33 : {
34 0 : }
35 :
36 : //------------------------------------------------------------------------
37 :
38 0 : SfxScriptOrganizerItem::SfxScriptOrganizerItem( const SfxScriptOrganizerItem& rItem ) :
39 :
40 : SfxStringItem( rItem ),
41 :
42 0 : aLanguage( rItem.aLanguage )
43 :
44 : {
45 0 : }
46 :
47 : //------------------------------------------------------------------------
48 :
49 0 : SfxScriptOrganizerItem::~SfxScriptOrganizerItem()
50 : {
51 0 : }
52 :
53 : //------------------------------------------------------------------------
54 :
55 0 : SfxPoolItem* SfxScriptOrganizerItem::Clone( SfxItemPool * ) const
56 : {
57 0 : return new SfxScriptOrganizerItem( *this );
58 : }
59 :
60 : //------------------------------------------------------------------------
61 :
62 0 : int SfxScriptOrganizerItem::operator==( const SfxPoolItem& rItem) const
63 : {
64 0 : return rItem.Type() == Type() &&
65 0 : SfxStringItem::operator==(rItem) &&
66 0 : aLanguage == ((const SfxScriptOrganizerItem &)rItem).aLanguage;
67 : }
68 :
69 :
70 0 : bool SfxScriptOrganizerItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
71 : {
72 0 : String aValue;
73 0 : sal_Bool bIsString = sal_False;
74 0 : sal_Bool bValue = sal_False;
75 0 : nMemberId &= ~CONVERT_TWIPS;
76 0 : switch ( nMemberId )
77 : {
78 : case 0:
79 : case MID_SCRIPT_ORGANIZER_LANGUAGE:
80 0 : bIsString = sal_True;
81 0 : aValue = aLanguage;
82 0 : break;
83 : default:
84 : OSL_FAIL("Wrong MemberId!");
85 0 : return false;
86 : }
87 :
88 0 : if ( bIsString )
89 0 : rVal <<= ::rtl::OUString( aValue );
90 : else
91 0 : rVal <<= bValue;
92 0 : return true;
93 : }
94 :
95 0 : bool SfxScriptOrganizerItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
96 : {
97 0 : ::rtl::OUString aValue;
98 0 : sal_Bool bRet = false;
99 0 : nMemberId &= ~CONVERT_TWIPS;
100 0 : switch ( nMemberId )
101 : {
102 : case 0:
103 : case MID_SCRIPT_ORGANIZER_LANGUAGE:
104 0 : bRet = (rVal >>= aValue);
105 0 : if ( bRet )
106 0 : aLanguage = aValue;
107 0 : break;
108 : default:
109 : OSL_FAIL("Wrong MemberId!");
110 0 : return false;
111 : }
112 :
113 0 : return bRet;
114 : }
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|