diff options
author | Tim Hardeck <thardeck@suse.de> | 2012-06-12 19:04:05 +0200 |
---|---|---|
committer | Tim Hardeck <thardeck@suse.de> | 2012-06-15 13:38:56 +0200 |
commit | 6484ccb4edad34d03d1300929fe20788f41b255e (patch) | |
tree | 81889977e5eebedc929206a82baaa00c30512090 /svx | |
parent | -Werror=unused-variable (diff) | |
download | core-6484ccb4edad34d03d1300929fe20788f41b255e.tar.gz core-6484ccb4edad34d03d1300929fe20788f41b255e.zip |
move zoomitem from svx to sfx2
To allow using SvxZoomItem in sfx2 zoomitem is moved from svx to sfx2.
This patch does base on Caolán McNamara's patch he sent to the mailing list.
Change-Id: I4d245f938d92ad3a20b692f5f76d8e0d00b1a648
Diffstat (limited to 'svx')
-rw-r--r-- | svx/Library_svx.mk | 1 | ||||
-rw-r--r-- | svx/Package_inc.mk | 1 | ||||
-rw-r--r-- | svx/inc/svx/svxids.hrc | 8 | ||||
-rw-r--r-- | svx/inc/svx/unomid.hxx | 3 | ||||
-rw-r--r-- | svx/inc/svx/zoomitem.hxx | 92 | ||||
-rw-r--r-- | svx/sdi/svx.sdi | 27 | ||||
-rw-r--r-- | svx/sdi/svxitems.sdi | 8 | ||||
-rw-r--r-- | svx/source/items/zoomitem.cxx | 228 | ||||
-rw-r--r-- | svx/source/stbctrls/zoomctrl.cxx | 2 |
9 files changed, 3 insertions, 367 deletions
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index ba8ffa181b61..c294c73d39da 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -158,7 +158,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/items/SmartTagItem \ svx/source/items/svxerr \ svx/source/items/viewlayoutitem \ - svx/source/items/zoomitem \ svx/source/items/zoomslideritem \ svx/source/mnuctrls/clipboardctl \ svx/source/mnuctrls/fntctl \ diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk index bd07e7b0caec..0b8014aac316 100644 --- a/svx/Package_inc.mk +++ b/svx/Package_inc.mk @@ -120,7 +120,6 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/unofill.hxx,svx/unofill.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/drawitem.hxx,svx/drawitem.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xmlgrhlp.hxx,svx/xmlgrhlp.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmresids.hrc,svx/fmresids.hrc)) -$(eval $(call gb_Package_add_file,svx_inc,inc/svx/zoomitem.hxx,svx/zoomitem.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtcfitm.hxx,svx/sdtcfitm.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdmetitm.hxx,svx/sdmetitm.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmtools.hxx,svx/fmtools.hxx)) diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index f66af83d2a3c..07b8dd7720bb 100644 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -82,10 +82,8 @@ #define MID_RIGHT_MARGIN 0x47 #define MID_ROW_DIRECTION 0x48 #define MID_SIZE 0x4a -#define MID_TYPE 0x4c -#define MID_UPPER 0x4d -#define MID_USExxx 0x4e -#define MID_VALUESET 0x4f +#define MID_UPPER 0x4b +#define MID_USExxx 0x4c #define MID_ADR_CITY 0x50 #define MID_ADR_COMPANY 0x51 @@ -412,8 +410,6 @@ // Svx-Id's // -------------------------------------------------------------------------- -#define SID_ATTR_ZOOM ( SID_SVX_START + 0 ) - #define SID_ATTR_BORDER_INNER ( SID_SVX_START + 23 ) diff --git a/svx/inc/svx/unomid.hxx b/svx/inc/svx/unomid.hxx index 828bbd50744b..356efb6e4069 100644 --- a/svx/inc/svx/unomid.hxx +++ b/svx/inc/svx/unomid.hxx @@ -65,9 +65,6 @@ #define MID_HORJUST_HORJUST 0 #define MID_HORJUST_ADJUST 1 -// SvxZoomItem -#define MID_VALUE 2 - // SvxObjectItem #define MID_START_X 1 #define MID_START_Y 2 diff --git a/svx/inc/svx/zoomitem.hxx b/svx/inc/svx/zoomitem.hxx deleted file mode 100644 index 77cf645fbacd..000000000000 --- a/svx/inc/svx/zoomitem.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_ZOOMITEM_HXX -#define _SVX_ZOOMITEM_HXX - -#include <svl/intitem.hxx> -#include <svx/svxids.hrc> -#include "svx/svxdllapi.h" - -//------------------------------------------------------------------------- - -enum SvxZoomType -{ - SVX_ZOOM_PERCENT, // GetValue() ist kein besonderer prozentualer Wert - SVX_ZOOM_OPTIMAL, // GetValue() entspricht der optimalen Gr"o\se - SVX_ZOOM_WHOLEPAGE, // GetValue() entspricht der ganzen Seite - SVX_ZOOM_PAGEWIDTH, // GetValue() entspricht der Seitenbreite - SVX_ZOOM_PAGEWIDTH_NOBORDER // GetValue() pagewidth without border -}; - -//------------------------------------------------------------------------- - -class SVX_DLLPUBLIC SvxZoomItem: public SfxUInt16Item -{ - sal_uInt16 nValueSet; // erlaubte Werte (siehe #defines unten) - SvxZoomType eType; - -public: - TYPEINFO(); - - SvxZoomItem( SvxZoomType eZoomType = SVX_ZOOM_PERCENT, - sal_uInt16 nVal = 0, sal_uInt16 nWhich = SID_ATTR_ZOOM ); - SvxZoomItem( const SvxZoomItem& ); - ~SvxZoomItem(); - - void SetValueSet( sal_uInt16 nValues ) { nValueSet = nValues; } - sal_uInt16 GetValueSet() const { return nValueSet; } - bool IsValueAllowed( sal_uInt16 nValue ) const - { return nValue == ( nValue & nValueSet ); } - - SvxZoomType GetType() const { return eType; } - void SetType( SvxZoomType eNewType ) - { eType = eNewType; } - - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream& rStrm, sal_uInt16 nVersion ) const; - virtual SvStream& Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const; - virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); -}; - -//------------------------------------------------------------------------ - -#define SVX_ZOOM_ENABLE_50 0x0001 -#define SVX_ZOOM_ENABLE_75 0x0002 -#define SVX_ZOOM_ENABLE_100 0x0004 -#define SVX_ZOOM_ENABLE_150 0x0008 -#define SVX_ZOOM_ENABLE_200 0x0010 -#define SVX_ZOOM_ENABLE_OPTIMAL 0x1000 -#define SVX_ZOOM_ENABLE_WHOLEPAGE 0x2000 -#define SVX_ZOOM_ENABLE_PAGEWIDTH 0x4000 -#define SVX_ZOOM_ENABLE_ALL 0x701F - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 8afec8b9e48e..5e1917576bb6 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -11786,33 +11786,6 @@ XLineStyleItem XLineStyle SID_ATTR_LINE_STYLE ] //-------------------------------------------------------------------------- -SvxZoomItem Zoom SID_ATTR_ZOOM - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = TRUE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- SfxVoidItem Zoom100Percent SID_SIZE_REAL () [ diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi index ef1a954f3983..6824a6d68f4c 100644 --- a/svx/sdi/svxitems.sdi +++ b/svx/sdi/svxitems.sdi @@ -599,14 +599,6 @@ struct SvxProtect }; item SvxProtect SvxProtectItem; -struct SvxZoom -{ - UINT16 Value MID_VALUE; - INT16 ValueSet MID_VALUESET; - INT16 Type MID_TYPE; -}; -item SvxZoom SvxZoomItem; - struct SvxRulerObject { INT32 StartX MID_START_X; diff --git a/svx/source/items/zoomitem.cxx b/svx/source/items/zoomitem.cxx deleted file mode 100644 index 226d18db865a..000000000000 --- a/svx/source/items/zoomitem.cxx +++ /dev/null @@ -1,228 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <tools/stream.hxx> -#include <basic/sbxvar.hxx> - -#include <svx/zoomitem.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/beans/PropertyValue.hpp> - -// ----------------------------------------------------------------------- - -TYPEINIT1_FACTORY(SvxZoomItem,SfxUInt16Item, new SvxZoomItem); - -#define ZOOM_PARAM_VALUE "Value" -#define ZOOM_PARAM_VALUESET "ValueSet" -#define ZOOM_PARAM_TYPE "Type" -#define ZOOM_PARAMS 3 - -// ----------------------------------------------------------------------- - -SvxZoomItem::SvxZoomItem -( - SvxZoomType eZoomType, - sal_uInt16 nVal, - sal_uInt16 _nWhich -) -: SfxUInt16Item( _nWhich, nVal ), - nValueSet( SVX_ZOOM_ENABLE_ALL ), - eType( eZoomType ) -{ -} - -// ----------------------------------------------------------------------- - -SvxZoomItem::SvxZoomItem( const SvxZoomItem& rOrig ) -: SfxUInt16Item( rOrig.Which(), rOrig.GetValue() ), - nValueSet( rOrig.GetValueSet() ), - eType( rOrig.GetType() ) -{ -} - -// ----------------------------------------------------------------------- - -SvxZoomItem::~SvxZoomItem() -{ -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxZoomItem::Clone( SfxItemPool * /*pPool*/ ) const -{ - return new SvxZoomItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxZoomItem::Create( SvStream& rStrm, sal_uInt16 /*nVersion*/ ) const -{ - sal_uInt16 nValue; - sal_uInt16 nValSet; - sal_Int8 nType; - rStrm >> nValue >> nValSet >> nType; - SvxZoomItem* pNew = new SvxZoomItem( (SvxZoomType)nType, nValue, Which() ); - pNew->SetValueSet( nValSet ); - return pNew; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxZoomItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm << (sal_uInt16)GetValue() - << nValueSet - << (sal_Int8)eType; - return rStrm; -} - -// ----------------------------------------------------------------------- - -int SvxZoomItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - SvxZoomItem& rItem = (SvxZoomItem&)rAttr; - - return ( GetValue() == rItem.GetValue() && - nValueSet == rItem.GetValueSet() && - eType == rItem.GetType() ); -} - -bool SvxZoomItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch ( nMemberId ) - { - case 0 : - { - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSeq( ZOOM_PARAMS ); - aSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ZOOM_PARAM_VALUE )); - aSeq[0].Value <<= sal_Int32( GetValue() ); - aSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ZOOM_PARAM_VALUESET )); - aSeq[1].Value <<= sal_Int16( nValueSet ); - aSeq[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ZOOM_PARAM_TYPE )); - aSeq[2].Value <<= sal_Int16( eType ); - rVal <<= aSeq; - } - break; - - case MID_VALUE: rVal <<= (sal_Int32) GetValue(); break; - case MID_VALUESET: rVal <<= (sal_Int16) nValueSet; break; - case MID_TYPE: rVal <<= (sal_Int16) eType; break; - default: - OSL_FAIL("svx::SvxZoomItem::QueryValue(), Wrong MemberId!"); - return false; - } - - return true; -} - -bool SvxZoomItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) -{ -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - switch ( nMemberId ) - { - case 0 : - { - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSeq; - if (( rVal >>= aSeq ) && ( aSeq.getLength() == ZOOM_PARAMS )) - { - sal_Int32 nValueTmp( 0 ); - sal_Int16 nValueSetTmp( 0 ); - sal_Int16 nTypeTmp( 0 ); - sal_Bool bAllConverted( sal_True ); - sal_Int16 nConvertedCount( 0 ); - for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ ) - { - if ( aSeq[i].Name.equalsAscii( ZOOM_PARAM_VALUE )) - { - bAllConverted &= ( aSeq[i].Value >>= nValueTmp ); - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( ZOOM_PARAM_VALUESET )) - { - bAllConverted &= ( aSeq[i].Value >>= nValueSetTmp ); - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( ZOOM_PARAM_TYPE )) - { - bAllConverted &= ( aSeq[i].Value >>= nTypeTmp ); - ++nConvertedCount; - } - } - - if ( bAllConverted && nConvertedCount == ZOOM_PARAMS ) - { - SetValue( (sal_uInt16)nValueTmp ); - nValueSet = nValueSetTmp; - eType = SvxZoomType( nTypeTmp ); - return true; - } - } - - return false; - } - - case MID_VALUE: - { - sal_Int32 nVal = 0; - if ( rVal >>= nVal ) - { - SetValue( (sal_uInt16)nVal ); - return true; - } - else - return false; - } - - case MID_VALUESET: - case MID_TYPE: - { - sal_Int16 nVal = sal_Int16(); - if ( rVal >>= nVal ) - { - if ( nMemberId == MID_VALUESET ) - nValueSet = (sal_Int16) nVal; - else if ( nMemberId == MID_TYPE ) - eType = SvxZoomType( (sal_Int16) nVal ); - return true; - } - else - return false; - } - - default: - OSL_FAIL("svx::SvxZoomItem::PutValue(), Wrong MemberId!"); - return false; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/stbctrls/zoomctrl.cxx b/svx/source/stbctrls/zoomctrl.cxx index 1284075842d0..eed821dd2e3e 100644 --- a/svx/source/stbctrls/zoomctrl.cxx +++ b/svx/source/stbctrls/zoomctrl.cxx @@ -35,7 +35,7 @@ #include <svx/dialogs.hrc> #include "svx/zoomctrl.hxx" -#include <svx/zoomitem.hxx> +#include <sfx2/zoomitem.hxx> #include "stbctrls.h" #include <svx/dialmgr.hxx> |