summaryrefslogtreecommitdiff
path: root/sw/source/ui/config/barcfg.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/config/barcfg.cxx')
-rw-r--r--sw/source/ui/config/barcfg.cxx183
1 files changed, 183 insertions, 0 deletions
diff --git a/sw/source/ui/config/barcfg.cxx b/sw/source/ui/config/barcfg.cxx
new file mode 100644
index 0000000000..1fa49711a6
--- /dev/null
+++ b/sw/source/ui/config/barcfg.cxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * $RCSfile: barcfg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:14:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "ui_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#ifndef _TOOLS_TABLE_HXX //autogen
+#include <tools/table.hxx>
+#endif
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+#include "barcfg.hxx"
+#include "cfgid.h"
+
+#define BAR_VERSION UINT16(1)
+
+DECLARE_TABLE(CfgUSHORTTable,void*);
+
+SwToolbarConfigItem::SwToolbarConfigItem( BOOL bWeb ) :
+ SfxConfigItem( bWeb ? CFG_TOOLBARCONFIG_ITEM : CFG_WEBTOOLBARCONFIG_ITEM ),
+ pTbl( new CfgUSHORTTable )
+{
+ SetInternal( TRUE );
+}
+
+SwToolbarConfigItem::~SwToolbarConfigItem()
+{
+ delete pTbl;
+}
+
+void SwToolbarConfigItem::SetTopToolbar( int nSelType, USHORT nBarId )
+{
+ if ( !pTbl->IsKeyValid( ULONG(nSelType) ) )
+ pTbl->Insert( ULONG(nSelType), (void*)(ULONG)nBarId );
+ else
+ pTbl->Replace( ULONG(nSelType), (void*)(ULONG)nBarId );
+}
+
+USHORT SwToolbarConfigItem::GetTopToolbar( int nSelType )
+{
+ if ( !pTbl->IsKeyValid( ULONG(nSelType) ) )
+ return USHRT_MAX;
+ else
+ return (USHORT)(ULONG)pTbl->Get( ULONG(nSelType) );
+}
+
+BOOL SwToolbarConfigItem::Store(SvStream& rStrm)
+{
+ rStrm << BAR_VERSION;
+ rStrm << UINT16(pTbl->Count());
+
+ if ( pTbl->Count() )
+ {
+ UINT16 nVal = UINT16((ULONG)pTbl->First());
+ while ( nVal )
+ {
+ UINT16 nKey = UINT16((ULONG)pTbl->GetCurKey());
+ rStrm << nKey << nVal;
+ nVal = UINT16((ULONG)pTbl->Next());
+ }
+ }
+
+ return SfxConfigItem::ERR_OK;
+}
+
+
+int SwToolbarConfigItem::Load(SvStream& rStrm)
+{
+ UINT16 nVersion;
+ rStrm >> nVersion;
+
+ if ( nVersion >= BAR_VERSION )
+ {
+ UINT16 nCount;
+ rStrm >> nCount;
+ if ( nCount )
+ {
+ for ( UINT16 i = 0; i < nCount; ++i )
+ {
+ UINT16 nKey, nVal;
+ rStrm >> nKey >> nVal;
+ pTbl->Insert( nKey, (void*)(ULONG)nVal );
+ }
+ }
+
+ SetDefault(FALSE);
+ return SfxConfigItem::ERR_OK;
+ }
+ else
+ return SfxConfigItem::WARNING_VERSION;
+}
+
+
+void SwToolbarConfigItem::UseDefault()
+{
+ SfxConfigItem::UseDefault();
+ pTbl->Clear();
+}
+
+/*------------------------------------------------------------------------
+
+ $Log: not supported by cvs2svn $
+ Revision 1.4 2000/09/18 16:05:15 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.3 1998/04/08 11:46:42 OS
+ einer noch..
+
+
+ Rev 1.2 08 Apr 1998 13:46:42 OS
+ einer noch..
+
+ Rev 1.1 08 Apr 1998 13:41:32 OS
+ Table mit void* -> fuer UNX und MAC
+
+ Rev 1.0 02 Apr 1998 10:06:04 MA
+ new: ToolbarCfg
+
+
+------------------------------------------------------------------------*/