diff options
author | Armin Le Grand <alg@apache.org> | 2012-07-30 16:36:56 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2012-07-30 16:36:56 +0000 |
commit | 5c6d55316b6cefab558bdf9ae84646933fd5e914 (patch) | |
tree | 42c8412264612e740fc60a3bce01a605428c0ae8 | |
parent | 76741df0b60b9157710f8e66720275749dbf98bd (diff) |
#116001# Reverted revision 1366087
Notes
Notes:
ignore: reverted
40 files changed, 274 insertions, 85 deletions
diff --git a/chart2/inc/pch/precompiled_chart2.hxx b/chart2/inc/pch/precompiled_chart2.hxx index 6eb3ae9ef788..4ab3b72206ba 100644 --- a/chart2/inc/pch/precompiled_chart2.hxx +++ b/chart2/inc/pch/precompiled_chart2.hxx @@ -91,6 +91,7 @@ #include "com/sun/star/drawing/ProjectionMode.hpp" #include "com/sun/star/drawing/RectanglePoint.hpp" #include "com/sun/star/drawing/ShadeMode.hpp" +#include "com/sun/star/drawing/TextFitToSizeType.hpp" #include "com/sun/star/drawing/TextHorizontalAdjust.hpp" #include "com/sun/star/drawing/TextVerticalAdjust.hpp" #include "com/sun/star/drawing/XDrawPage.hpp" diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 5ee983b295d3..eff9de5bf80f 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> #include <com/sun/star/drawing/ProjectionMode.hpp> #include <com/sun/star/drawing/ShadeMode.hpp> +#include <com/sun/star/drawing/TextFitToSizeType.hpp> #include <com/sun/star/drawing/TextureProjectionMode.hpp> #include <com/sun/star/text/XText.hpp> #include <com/sun/star/uno/Any.hxx> diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx index cb7e3dd301e1..7219eba0aec2 100644 --- a/cui/inc/pch/precompiled_cui.hxx +++ b/cui/inc/pch/precompiled_cui.hxx @@ -217,6 +217,7 @@ #include "com/sun/star/drawing/TextAdjust.hpp" #include "com/sun/star/drawing/TextAnimationDirection.hpp" #include "com/sun/star/drawing/TextAnimationKind.hpp" +#include "com/sun/star/drawing/TextFitToSizeType.hpp" #include "com/sun/star/drawing/TextHorizontalAdjust.hpp" #include "com/sun/star/drawing/TextVerticalAdjust.hpp" #include "com/sun/star/drawing/TextureKind.hpp" diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx index 827317bc2099..606585d96f75 100644 --- a/cui/source/tabpages/textattr.cxx +++ b/cui/source/tabpages/textattr.cxx @@ -347,8 +347,9 @@ void __EXPORT SvxTextAttrPage::Reset( const SfxItemSet& rAttrs ) // Am Rahmen anpassen if ( rAttrs.GetItemState( SDRATTR_TEXT_FITTOSIZE ) != SFX_ITEM_DONTCARE ) { - const sal_Bool bFTS = ( ( const SdrTextFitToSizeTypeItem& )rAttrs.Get( SDRATTR_TEXT_FITTOSIZE ) ).GetValue(); - aTsbFitToSize.SetState( bFTS ? STATE_CHECK : STATE_NOCHECK ); + SdrFitToSizeType eFTS = (SdrFitToSizeType) + ( ( const SdrTextFitToSizeTypeItem& )rAttrs.Get( SDRATTR_TEXT_FITTOSIZE ) ).GetValue(); + aTsbFitToSize.SetState( eFTS == SDRTEXTFIT_NONE ? STATE_NOCHECK : STATE_CHECK ); aTsbFitToSize.EnableTriState( sal_False ); } else @@ -442,15 +443,16 @@ sal_Bool SvxTextAttrPage::FillItemSet( SfxItemSet& rAttrs) eState = aTsbFitToSize.GetState(); if( eState != aTsbFitToSize.GetSavedValue() ) { - sal_Bool bFTS; + SdrFitToSizeType eFTS; switch( eState ) { default: ; //prevent warning DBG_ERROR( "svx::SvxTextAttrPage::FillItemSet(), unhandled state!" ); - case STATE_NOCHECK: bFTS = sal_False; break; - case STATE_CHECK: bFTS = sal_True; break; + case STATE_NOCHECK: eFTS = SDRTEXTFIT_NONE; break; + //case STATE_CHECK: eFTS = SDRTEXTFIT_RESIZEATTR; break; + case STATE_CHECK: eFTS = SDRTEXTFIT_PROPORTIONAL; break; } - rAttrs.Put( SdrTextFitToSizeTypeItem( bFTS ) ); + rAttrs.Put( SdrTextFitToSizeTypeItem( eFTS ) ); } // zentriert diff --git a/editeng/inc/pch/precompiled_editeng.hxx b/editeng/inc/pch/precompiled_editeng.hxx index bb07337d8744..6bb1fc10eb21 100644 --- a/editeng/inc/pch/precompiled_editeng.hxx +++ b/editeng/inc/pch/precompiled_editeng.hxx @@ -192,6 +192,7 @@ #include "com/sun/star/drawing/TextAdjust.hpp" #include "com/sun/star/drawing/TextAnimationDirection.hpp" #include "com/sun/star/drawing/TextAnimationKind.hpp" +#include "com/sun/star/drawing/TextFitToSizeType.hpp" #include "com/sun/star/drawing/TextHorizontalAdjust.hpp" #include "com/sun/star/drawing/TextVerticalAdjust.hpp" #include "com/sun/star/drawing/TextureKind.hpp" diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 92d9107ccb0e..ae96be213f4d 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -77,6 +77,7 @@ #include <com/sun/star/drawing/ProjectionMode.hpp> #include <com/sun/star/text/XSimpleText.hpp> #include <com/sun/star/drawing/ShadeMode.hpp> +#include <com/sun/star/drawing/TextFitToSizeType.hpp> #include <vcl/hatch.hxx> #include <com/sun/star/awt/XGraphics.hpp> #include <com/sun/star/awt/FontSlant.hpp> @@ -3146,6 +3147,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextHorizontalAdjust" ) ), sal_True ) ) { MSO_GeoTextAlign gTextAlign = mso_alignTextCenter; + SdrFitToSizeType eFTS( ((SdrTextFitToSizeTypeItem&)pCustoShape->GetMergedItem( SDRATTR_TEXT_FITTOSIZE )).GetValue() ); drawing::TextHorizontalAdjust eHA( drawing::TextHorizontalAdjust_LEFT ); aAny >>= eHA; switch( eHA ) @@ -3161,9 +3163,8 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT break; case drawing::TextHorizontalAdjust_BLOCK: { - const sal_Bool bFTS(((SdrTextFitToSizeTypeItem&)pCustoShape->GetMergedItem(SDRATTR_TEXT_FITTOSIZE)).GetValue()); - - if(bFTS) + SdrFitToSizeType eFTS( ((SdrTextFitToSizeTypeItem&)pCustoShape->GetMergedItem( SDRATTR_TEXT_FITTOSIZE )).GetValue() ); + if ( eFTS == SDRTEXTFIT_ALLLINES) { gTextAlign = mso_alignTextStretch; } diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index a8602f3aff8b..7ca071fe8aee 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -3731,7 +3731,8 @@ SdrObject* SvxMSDffManager::ImportFontWork( SvStream& rStCt, SfxItemSet& rSet, R { pNewObj->SetModel( pSdrModel ); ((SdrRectObj*)pNewObj)->SetText( aObjectText ); - rSet.Put( SdrTextFitToSizeTypeItem( sal_True ) ); + SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL; + rSet.Put( SdrTextFitToSizeTypeItem( eFTS ) ); rSet.Put( SdrTextAutoGrowHeightItem( sal_False ) ); rSet.Put( SdrTextAutoGrowWidthItem( sal_False ) ); rSet.Put( SvxFontItem( FAMILY_DONTKNOW, aFontName, String(), @@ -4419,7 +4420,11 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r case mso_alignTextRight : eHorzAdjust = SDRTEXTHORZADJUST_RIGHT; break; } aSet.Put( SdrTextHorzAdjustItem( eHorzAdjust ) ); - aSet.Put(SdrTextFitToSizeTypeItem(eGeoTextAlign == mso_alignTextStretch ? sal_True: sal_False)); + + SdrFitToSizeType eFTS = SDRTEXTFIT_NONE; + if ( eGeoTextAlign == mso_alignTextStretch ) + eFTS = SDRTEXTFIT_ALLLINES; + aSet.Put( SdrTextFitToSizeTypeItem( eFTS ) ); } if ( IsProperty( DFF_Prop_gtextSpacing ) ) { diff --git a/offapi/com/sun/star/drawing/TextFitToSizeType.idl b/offapi/com/sun/star/drawing/TextFitToSizeType.idl new file mode 100644 index 000000000000..495a04cff862 --- /dev/null +++ b/offapi/com/sun/star/drawing/TextFitToSizeType.idl @@ -0,0 +1,70 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + + +#ifndef __com_sun_star_drawing_TextFitToSizeType_idl__ +#define __com_sun_star_drawing_TextFitToSizeType_idl__ + + +//============================================================================= + + module com { module sun { module star { module drawing { + +//============================================================================= + +// DocMerge from xml: enum com::sun::star::drawing::TextFitToSizeType +/** This enumeration specifies how the text within a shape relates to the + size of the shape. + */ +published enum TextFitToSizeType +{ + //------------------------------------------------------------------------- + /** the text size is only defined by the font properties + */ + NONE, + + //------------------------------------------------------------------------- + + /** if the shape is scaled, the text character size is scaled proportional + */ + PROPORTIONAL, + + //------------------------------------------------------------------------- + + /** like <code>PROPORTIONAL</code>, but the width of each text row is + also scaled proportional. + */ + ALLLINES, + + //------------------------------------------------------------------------- + + /** if the shape is scaled, the font attributes are scaled and hard set + on the text */ + RESIZEATTR + +}; + +//============================================================================= + +}; }; }; }; + +#endif + diff --git a/offapi/com/sun/star/drawing/TextProperties.idl b/offapi/com/sun/star/drawing/TextProperties.idl index c49018c8b552..a0bf27f7e756 100644 --- a/offapi/com/sun/star/drawing/TextProperties.idl +++ b/offapi/com/sun/star/drawing/TextProperties.idl @@ -51,6 +51,10 @@ #include <com/sun/star/style/ParagraphPropertiesComplex.idl> #endif +#ifndef __com_sun_star_drawing_TextFitToSizeType_idl__ +#include <com/sun/star/drawing/TextFitToSizeType.idl> +#endif + #ifndef __com_sun_star_drawing_TextAdjust_idl__ #include <com/sun/star/drawing/TextAdjust.idl> #endif @@ -172,7 +176,7 @@ published service TextProperties /** With this set to <TRUE/>, the text inside of the <type>Shape</type> is stretched to fit into the <type>Shape</type>. */ - [property] boolean TextFitToSize; + [property] com::sun::star::drawing::TextFitToSizeType TextFitToSize; //------------------------------------------------------------------------- diff --git a/offapi/com/sun/star/drawing/makefile.mk b/offapi/com/sun/star/drawing/makefile.mk index 847e0093f28e..6c7a23fc747d 100644 --- a/offapi/com/sun/star/drawing/makefile.mk +++ b/offapi/com/sun/star/drawing/makefile.mk @@ -169,6 +169,7 @@ IDLFILES=\ TextAdjust.idl\ TextAnimationDirection.idl\ TextAnimationKind.idl\ + TextFitToSizeType.idl\ TextHorizontalAdjust.idl\ TextProperties.idl\ TextShape.idl\ diff --git a/offapi/type_reference/typelibrary_history.txt b/offapi/type_reference/typelibrary_history.txt index 09847ce5c5d1..1b47f11b3841 100644 --- a/offapi/type_reference/typelibrary_history.txt +++ b/offapi/type_reference/typelibrary_history.txt @@ -189,7 +189,3 @@ 06/11/2012 (JSC): TaskID=119944 Update reference type library to 3.4 version - -07/26/2012 (ALG): TaskId=116001 - Changed type of TextFitToSize too boolean and removed TextFitToSizeType - accordingly due to being boolean in implementation/core and in ODF, too. diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb Binary files differindex 35fca2ed8fa2..c9264fe7b57c 100644 --- a/offapi/type_reference/types.rdb +++ b/offapi/type_reference/types.rdb diff --git a/sc/source/ui/vba/vbatextframe.cxx b/sc/source/ui/vba/vbatextframe.cxx index 4fc69eb82cb6..cab5f75fb6b4 100644 --- a/sc/source/ui/vba/vbatextframe.cxx +++ b/sc/source/ui/vba/vbatextframe.cxx @@ -21,6 +21,7 @@ #include <vbahelper/helperdecl.hxx> +#include <com/sun/star/drawing/TextFitToSizeType.hpp> #include <com/sun/star/text/XText.hpp> #include "vbatextframe.hxx" #include "vbacharacters.hxx" diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index 4c1454f595ed..e44f6b260a24 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -21,9 +21,16 @@ +enum SdrFitToSizeType +{ + SDRTEXTFIT_NONE , + SDRTEXTFIT_PROPORTIONAL , + SDRTEXTFIT_ALLLINES , + SDRTEXTFIT_RESIZEATTR +} item UINT32 SvxObjectItem ; item BOOL SdrShadowItem ; -item BOOL SdrTextFitToSizeTypeItem ; +item SdrFitToSizeType SdrTextFitToSizeTypeItem ; interface DrawView diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index 2a02c7cbfad2..3cb88f4530a1 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -593,7 +593,8 @@ void FuText::ImpSetAttributesFitToSize(SdrTextObj* pTxtObj) { // FitToSize (An Rahmen anpassen) SfxItemSet aSet(mpViewShell->GetPool(), SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWWIDTH); - aSet.Put(SdrTextFitToSizeTypeItem(sal_True)); + SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL; + aSet.Put(SdrTextFitToSizeTypeItem(eFTS)); aSet.Put(SdrTextAutoGrowHeightItem(sal_False)); aSet.Put(SdrTextAutoGrowWidthItem(sal_False)); pTxtObj->SetMergedItemSet(aSet); @@ -603,8 +604,10 @@ void FuText::ImpSetAttributesFitToSize(SdrTextObj* pTxtObj) // #97016# void FuText::ImpSetAttributesFitToSizeVertical(SdrTextObj* pTxtObj) { - SfxItemSet aSet(mpViewShell->GetPool(), SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWWIDTH); - aSet.Put(SdrTextFitToSizeTypeItem(sal_True)); + SfxItemSet aSet(mpViewShell->GetPool(), + SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWWIDTH); + SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL; + aSet.Put(SdrTextFitToSizeTypeItem(eFTS)); aSet.Put(SdrTextAutoGrowHeightItem(sal_False)); aSet.Put(SdrTextAutoGrowWidthItem(sal_False)); pTxtObj->SetMergedItemSet(aSet); diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index 9d33b1264ae6..947ca08aaa9a 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -217,6 +217,7 @@ #include "com/sun/star/drawing/TextAdjust.hpp" #include "com/sun/star/drawing/TextAnimationDirection.hpp" #include "com/sun/star/drawing/TextAnimationKind.hpp" +#include "com/sun/star/drawing/TextFitToSizeType.hpp" #include "com/sun/star/drawing/TextHorizontalAdjust.hpp" #include "com/sun/star/drawing/TextVerticalAdjust.hpp" #include "com/sun/star/drawing/TextureKind.hpp" diff --git a/svx/inc/svx/sdtfsitm.hxx b/svx/inc/svx/sdtfsitm.hxx index 5439abfc28a5..d98fa5066b1c 100644 --- a/svx/inc/svx/sdtfsitm.hxx +++ b/svx/inc/svx/sdtfsitm.hxx @@ -27,18 +27,41 @@ #include <svx/svddef.hxx> #include "svx/svxdllapi.h" +enum SdrFitToSizeType {SDRTEXTFIT_NONE, // - kein FitToSize + SDRTEXTFIT_PROPORTIONAL, // - Alle Buchstaben proportional umgroessern + SDRTEXTFIT_ALLLINES, // - Zus. jede Zeile separat in der Breite stretchen + SDRTEXTFIT_RESIZEATTR}; // - Bei Rahmenumgroesserung (ausser Autogrow) wird + // die Schriftgroesse umattributiert (hart) + +// Bei SDRTEXTFIT_PROPORTIONAL und SDRTEXTFIT_ALLLINES gibt es kein AutoGrow und +// keine automatischen Umbrueche. +// Ist SDRTEXTFIT_RESIZEATTR gesetzt, so wird beim umgroessern des Textrahmens +// (ausser bei AutoGrow) die Schrift durch harte Attributierung ebenfalls +// umgegroessert. +// Bei AutoGrowingWidth gibt es ebenfalls keine automatischen Umbrueche (erst bei +// TextMaxFrameWidth). + //-------------------------------- // class SdrTextFitToSizeTypeItem //-------------------------------- -class SVX_DLLPUBLIC SdrTextFitToSizeTypeItem: public SfxBoolItem { +class SVX_DLLPUBLIC SdrTextFitToSizeTypeItem: public SfxEnumItem { public: TYPEINFO(); - SdrTextFitToSizeTypeItem(sal_Bool bFit = sal_False): SfxBoolItem(SDRATTR_TEXT_FITTOSIZE, bFit) {} - SdrTextFitToSizeTypeItem(SvStream& rIn) : SfxBoolItem(SDRATTR_TEXT_FITTOSIZE, rIn) {} - virtual SfxPoolItem* Clone(SfxItemPool* pPool = NULL) const; - virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const; - virtual String GetValueTextByVal(sal_Bool bVal) const; + SdrTextFitToSizeTypeItem(SdrFitToSizeType eFit=SDRTEXTFIT_NONE): SfxEnumItem(SDRATTR_TEXT_FITTOSIZE,(sal_uInt16)eFit) {} + SdrTextFitToSizeTypeItem(SvStream& rIn) : SfxEnumItem(SDRATTR_TEXT_FITTOSIZE,rIn) {} + virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const; + virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const; + virtual sal_uInt16 GetValueCount() const; // { return 4; } + SdrFitToSizeType GetValue() const { return (SdrFitToSizeType)SfxEnumItem::GetValue(); } + + virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual String GetValueTextByPos(sal_uInt16 nPos) const; virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const; + virtual int HasBoolValue() const; + virtual sal_Bool GetBoolValue() const; + virtual void SetBoolValue(sal_Bool bVal); }; #endif diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx index 64c03e0fce87..dc5e8583f24f 100644 --- a/svx/inc/svx/svdotext.hxx +++ b/svx/inc/svx/svdotext.hxx @@ -294,7 +294,7 @@ protected: FASTBOOL NbcSetAutoGrowWidth(bool bAuto); FASTBOOL NbcSetMinTextFrameWidth(long nWdt); FASTBOOL NbcSetMaxTextFrameWidth(long nWdt); - FASTBOOL NbcSetFitToSize(sal_Bool bFit); + FASTBOOL NbcSetFitToSize(SdrFitToSizeType eFit); // Konstruktoren fuer beschriftete Zeichenobjekte SdrTextObj(); @@ -386,7 +386,7 @@ public: long GetMinTextFrameWidth() const; long GetMaxTextFrameWidth() const; - sal_Bool GetFitToSize() const; + SdrFitToSizeType GetFitToSize() const; const Rectangle &GetGeoRect() const { return aRect; } // Feststellen, ob TextFontwork diff --git a/svx/inc/svx/svdstr.hrc b/svx/inc/svx/svdstr.hrc index 92956c4bb8a7..1c9a34901a33 100644 --- a/svx/inc/svx/svdstr.hrc +++ b/svx/inc/svx/svdstr.hrc @@ -355,6 +355,8 @@ #define STR_ItemValCAPTIONESCBESTFIT (STR_ItemValBegin + 10) #define STR_ItemValFITTOSIZENONE (STR_ItemValBegin + 11) #define STR_ItemValFITTOSIZEPROP (STR_ItemValBegin + 12) +#define STR_ItemValFITTOSIZEALLLINES (STR_ItemValBegin + 13) +#define STR_ItemValFITTOSIZERESIZEAT (STR_ItemValBegin + 14) #define STR_ItemValTEXTVADJTOP (STR_ItemValBegin + 15) #define STR_ItemValTEXTVADJCENTER (STR_ItemValBegin + 16) #define STR_ItemValTEXTVADJBOTTOM (STR_ItemValBegin + 17) diff --git a/svx/inc/svx/unoshprp.hxx b/svx/inc/svx/unoshprp.hxx index 6aed29830e4e..5c31a0aaa8f4 100644 --- a/svx/inc/svx/unoshprp.hxx +++ b/svx/inc/svx/unoshprp.hxx @@ -40,6 +40,7 @@ #include <com/sun/star/awt/Rectangle.hpp> #include <com/sun/star/drawing/TextAnimationDirection.hpp> #include <com/sun/star/drawing/TextAnimationKind.hpp> +#include <com/sun/star/drawing/TextFitToSizeType.hpp> #include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> #include <com/sun/star/drawing/ConnectorType.hpp> @@ -282,7 +283,7 @@ { MAP_CHAR_LEN(UNO_NAME_TEXT_AUTOGROWHEIGHT), SDRATTR_TEXT_AUTOGROWHEIGHT, &::getBooleanCppuType(), 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_TEXT_AUTOGROWWIDTH), SDRATTR_TEXT_AUTOGROWWIDTH, &::getBooleanCppuType(), 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_TEXT_CONTOURFRAME), SDRATTR_TEXT_CONTOURFRAME, &::getBooleanCppuType(), 0, 0}, \ - { MAP_CHAR_LEN(UNO_NAME_TEXT_FITTOSIZE), SDRATTR_TEXT_FITTOSIZE, &::getBooleanCppuType(), 0, 0}, \ + { MAP_CHAR_LEN(UNO_NAME_TEXT_FITTOSIZE), SDRATTR_TEXT_FITTOSIZE, &::getCppuType((const ::com::sun::star::drawing::TextFitToSizeType*)0), 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_TEXT_HORZADJUST), SDRATTR_TEXT_HORZADJUST, &::getCppuType((const ::com::sun::star::drawing::TextHorizontalAdjust*)0), 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_TEXT_LEFTDIST), SDRATTR_TEXT_LEFTDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \ { MAP_CHAR_LEN(UNO_NAME_TEXT_LOWERDIST), SDRATTR_TEXT_LOWERDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \ diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 2d5107acc0a0..0847c6dd3067 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -10851,7 +10851,7 @@ SfxBoolItem TextdirectionTopToBottom SID_TEXTDIRECTION_TOP_TO_BOTTOM ] //-------------------------------------------------------------------------- -SfxBoolItem TextFitToSize SID_ATTR_TEXT_FITTOSIZE +SdrTextFitToSizeTypeItem TextFitToSize SID_ATTR_TEXT_FITTOSIZE [ /* flags: */ diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi index 1b79aeca2b73..e09880bf11bf 100644 --- a/svx/sdi/svxitems.sdi +++ b/svx/sdi/svxitems.sdi @@ -395,7 +395,7 @@ item SvxCellHorJustifyEnum SvxHorJustifyItem; item SvxCellVerJustifyEnum SvxVerJustifyItem; item SvxCellOrientationEnum SvxOrientationItem; item BOOL SdrShadowItem; -item BOOL SdrTextFitToSizeTypeItem; +item INT16 SdrTextFitToSizeTypeItem; // enum item String SfxStringListItem; // serialized into one concatenated string item double SvxDoubleItem; item String OfaPtrItem; // serialized into one concatenated string diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index 64255591d277..0d78a6e92fe2 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -449,7 +449,7 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape ) { SdrTextHorzAdjust eHorzAdjust( ((SdrTextHorzAdjustItem&)pCustomShape->GetMergedItem( SDRATTR_TEXT_HORZADJUST )).GetValue() ); - const sal_Bool bFTS(((SdrTextFitToSizeTypeItem&)pCustomShape->GetMergedItem(SDRATTR_TEXT_FITTOSIZE)).GetValue()); + SdrFitToSizeType eFTS( ((SdrTextFitToSizeTypeItem&)pCustomShape->GetMergedItem( SDRATTR_TEXT_FITTOSIZE )).GetValue() ); std::vector< FWTextArea >::iterator aTextAreaIter = rFWData.vTextAreas.begin(); std::vector< FWTextArea >::iterator aTextAreaIEnd = rFWData.vTextAreas.end(); @@ -468,7 +468,7 @@ void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape ) while ( aTextAreaIter != aTextAreaIEnd ) { GetTextAreaOutline( rFWData, pCustomShape, *aTextAreaIter, bSameLetterHeights ); - if(bFTS ) + if ( eFTS == SDRTEXTFIT_ALLLINES ) { std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() ); std::vector< FWParagraphData >::iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() ); diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 156c3654630f..d25bafd9859d 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -527,7 +527,7 @@ namespace drawinglayer } } - const sal_Bool bFitToSize(rTextObj.GetFitToSize()); + const SdrFitToSizeType eFit(rTextObj.GetFitToSize()); const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind()); // #i107346# @@ -545,7 +545,7 @@ namespace drawinglayer rTextObj.GetTextHorizontalAdjust(rSet), rTextObj.GetTextVerticalAdjust(rSet), ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(), - bFitToSize, + (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit), ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(), SDRTEXTANI_BLINK == eAniKind, SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind, diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 7f9e85f0ec23..cd6ca5244932 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -25,6 +25,7 @@ #include "precompiled_svx.hxx" +#include <com/sun/star/drawing/TextFitToSizeType.hpp> #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> #include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/drawing/TextAnimationKind.hpp> @@ -1093,22 +1094,23 @@ SfxItemPresentation __EXPORT SdrCaptionEscDirItem::GetPresentation(SfxItemPresen //////////////////////////////////////////////////////////////////////////////// // FitToSize -TYPEINIT1_AUTOFACTORY(SdrTextFitToSizeTypeItem,SfxBoolItem); +TYPEINIT1_AUTOFACTORY(SdrTextFitToSizeTypeItem,SfxEnumItem); -SfxPoolItem* __EXPORT SdrTextFitToSizeTypeItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrTextFitToSizeTypeItem(*this); } +SfxPoolItem* __EXPORT SdrTextFitToSizeTypeItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrTextFitToSizeTypeItem(*this); } SfxPoolItem* __EXPORT SdrTextFitToSizeTypeItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrTextFitToSizeTypeItem(rIn); } -XubString __EXPORT SdrTextFitToSizeTypeItem::GetValueTextByVal(sal_Bool bVal) const +sal_uInt16 __EXPORT SdrTextFitToSizeTypeItem::GetValueCount() const { return 4; } + +XubString __EXPORT SdrTextFitToSizeTypeItem::GetValueTextByPos(sal_uInt16 nPos) const { - if (bVal) return ImpGetResStr(STR_ItemValFITTOSIZEPROP); - else return ImpGetResStr(STR_ItemValFITTOSIZENONE); + return ImpGetResStr(STR_ItemValFITTOSIZENONE+nPos); } SfxItemPresentation __EXPORT SdrTextFitToSizeTypeItem::GetPresentation(SfxItemPresentation ePres, - SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const + SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const { - rText=GetValueTextByVal(GetValue()); + rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue())); if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) { String aStr; @@ -1119,6 +1121,37 @@ SfxItemPresentation __EXPORT SdrTextFitToSizeTypeItem::GetPresentation(SfxItemPr return ePres; } +int __EXPORT SdrTextFitToSizeTypeItem::HasBoolValue() const { return sal_True; } + +sal_Bool __EXPORT SdrTextFitToSizeTypeItem::GetBoolValue() const { return GetValue()!=SDRTEXTFIT_NONE; } + +void __EXPORT SdrTextFitToSizeTypeItem::SetBoolValue(sal_Bool bVal) { SetValue(sal::static_int_cast< sal_uInt16 >(bVal ? SDRTEXTFIT_PROPORTIONAL : SDRTEXTFIT_NONE)); } + +sal_Bool SdrTextFitToSizeTypeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const +{ + drawing::TextFitToSizeType eFS = (drawing::TextFitToSizeType)GetValue(); + rVal <<= eFS; + + return sal_True; +} + +sal_Bool SdrTextFitToSizeTypeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) +{ + drawing::TextFitToSizeType eFS; + if(!(rVal >>= eFS)) + { + sal_Int32 nEnum = 0; + if(!(rVal >>= nEnum)) + return sal_False; + + eFS = (drawing::TextFitToSizeType) nEnum; + } + + SetValue( sal::static_int_cast< sal_uInt16 >( (SdrFitToSizeType)eFS ) ); + + return sal_True; +} + TYPEINIT1_AUTOFACTORY(SdrTextVertAdjustItem,SfxEnumItem); SfxPoolItem* __EXPORT SdrTextVertAdjustItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrTextVertAdjustItem(*this); } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 4e0504c60434..1b20db1a639b 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -672,10 +672,9 @@ sal_Bool SdrObjEditView::SdrBeginTextEdit( if ( !pTextObj->IsContourTextFrame() ) { // FitToSize erstmal nicht mit ContourFrame - if(pTextObj->GetFitToSize()) - { + SdrFitToSizeType eFit = pTextObj->GetFitToSize(); + if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES) aTextRect = aAnchorRect; - } } aTextEditArea = aTextRect; @@ -742,10 +741,9 @@ sal_Bool SdrObjEditView::SdrBeginTextEdit( // #71519# if(!bExtraInvalidate) { - if(pTextObj->GetFitToSize()) - { + SdrFitToSizeType eFit = pTextObj->GetFitToSize(); + if(eFit == SDRTEXTFIT_PROPORTIONAL || eFit == SDRTEXTFIT_ALLLINES) bExtraInvalidate = sal_True; - } } if(bExtraInvalidate) diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 42402f01cb2d..1397dffb6aae 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -953,7 +953,7 @@ void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const XubString& rS pText->SetMergedItem ( SdrTextLowerDistItem (0)); pText->SetMergedItem ( SdrTextRightDistItem (0)); pText->SetMergedItem ( SdrTextLeftDistItem (0)); - pText->SetMergedItem( SdrTextFitToSizeTypeItem( sal_True ) ); + pText->SetMergedItem( SdrTextFitToSizeTypeItem( SDRTEXTFIT_ALLLINES ) ); } else pText->SetMergedItem( SdrTextAutoGrowWidthItem( true ) ); diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx index 4f745477d4ae..97a7c473b523 100644 --- a/svx/source/svdraw/svdibrow.cxx +++ b/svx/source/svdraw/svdibrow.cxx @@ -821,8 +821,8 @@ FASTBOOL IsItemIneffective(sal_uInt16 nWhich, const SfxItemSet* pSet, sal_uInt16 case SDRATTR_TEXT_VERTADJUST: case SDRATTR_TEXT_HORZADJUST: { if (ImpGetItem(*pSet,SDRATTR_TEXT_FITTOSIZE,pItem)) { - sal_Bool bFit=((const SdrTextFitToSizeTypeItem*)pItem)->GetValue(); - if (bFit) return sal_True; + SdrFitToSizeType eFit=((const SdrTextFitToSizeTypeItem*)pItem)->GetValue(); + if (eFit!=SDRTEXTFIT_NONE) return sal_True; } } break; diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 566236e81688..64941de3c9c2 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -712,11 +712,11 @@ FASTBOOL SdrTextObj::NbcSetMaxTextFrameWidth(long nWdt) return sal_False; } -FASTBOOL SdrTextObj::NbcSetFitToSize(sal_Bool bFit) +FASTBOOL SdrTextObj::NbcSetFitToSize(SdrFitToSizeType eFit) { if(bTextFrame) { - SetObjectItem(SdrTextFitToSizeTypeItem(bFit)); + SetObjectItem(SdrTextFitToSizeTypeItem(eFit)); return sal_True; } return sal_False; @@ -829,7 +829,11 @@ void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FAS SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust(); SdrTextAniKind eAniKind=GetTextAniKind(); SdrTextAniDirection eAniDirection=GetTextAniDirection(); + + SdrFitToSizeType eFit=GetFitToSize(); + FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); FASTBOOL bContourFrame=IsContourTextFrame(); + FASTBOOL bFrame=IsTextFrame(); sal_uIntPtr nStat0=rOutliner.GetControlWord(); Size aNullSize; @@ -840,7 +844,7 @@ void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FAS rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000)); } - if (!GetFitToSize() && !bContourFrame) + if (!bFitToSize && !bContourFrame) { long nAnkWdt=aAnkRect.GetWidth(); long nAnkHgt=aAnkRect.GetHeight(); @@ -1266,7 +1270,9 @@ basegfx::B2DPolyPolygon SdrTextObj::TakeContour() const Rectangle aR; TakeTextRect(rOutliner,aR,sal_False,&aAnchor2); rOutliner.Clear(); - if (GetFitToSize()) aR=aAnchor2; + SdrFitToSizeType eFit=GetFitToSize(); + FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); + if (bFitToSize) aR=aAnchor2; Polygon aPol(aR); if (aGeo.nDrehWink!=0) RotatePoly(aPol,aR.TopLeft(),aGeo.nSin,aGeo.nCos); @@ -1382,7 +1388,8 @@ void SdrTextObj::ImpSetupDrawOutlinerForPaint( FASTBOOL bContourFrame, if (!bContourFrame) { // FitToSize erstmal nicht mit ContourFrame - if(GetFitToSize()) + SdrFitToSizeType eFit=GetFitToSize(); + if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES) { sal_uIntPtr nStat=rOutliner.GetControlWord(); nStat|=EE_CNTRL_STRETCHING|EE_CNTRL_AUTOPAGESIZE; @@ -1396,7 +1403,8 @@ void SdrTextObj::ImpSetupDrawOutlinerForPaint( FASTBOOL bContourFrame, if (!bContourFrame) { // FitToSize erstmal nicht mit ContourFrame - if(GetFitToSize()) + SdrFitToSizeType eFit=GetFitToSize(); + if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES) { ImpSetCharStretching(rOutliner,rTextRect,rAnchorRect,rFitXKorreg); rPaintRect=rAnchorRect; @@ -1551,16 +1559,14 @@ void SdrTextObj::RestGeoData(const SdrObjGeoData& rGeo) SetTextSizeDirty(); } -sal_Bool SdrTextObj::GetFitToSize() const +SdrFitToSizeType SdrTextObj::GetFitToSize() const { - sal_Bool bType(sal_False); + SdrFitToSizeType eType = SDRTEXTFIT_NONE; if(!IsAutoGrowWidth()) - { - bType = ((SdrTextFitToSizeTypeItem&)(GetObjectItem(SDRATTR_TEXT_FITTOSIZE))).GetValue(); - } + eType = ((SdrTextFitToSizeTypeItem&)(GetObjectItem(SDRATTR_TEXT_FITTOSIZE))).GetValue(); - return bType; + return eType; } void SdrTextObj::ForceOutlinerParaObject() diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx index c181f2638a4a..386b55f7ba1b 100644 --- a/svx/source/svdraw/svdotxat.cxx +++ b/svx/source/svdraw/svdotxat.cxx @@ -75,6 +75,8 @@ FASTBOOL SdrTextObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt, { if (bTextFrame && pModel!=NULL && !rR.IsEmpty()) { + SdrFitToSizeType eFit=GetFitToSize(); + FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); FASTBOOL bWdtGrow=bWdt && IsAutoGrowWidth(); FASTBOOL bHgtGrow=bHgt && IsAutoGrowHeight(); SdrTextAniKind eAniKind=GetTextAniKind(); @@ -82,7 +84,7 @@ FASTBOOL SdrTextObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt, FASTBOOL bScroll=eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE; FASTBOOL bHScroll=bScroll && (eAniDir==SDRTEXTANI_LEFT || eAniDir==SDRTEXTANI_RIGHT); FASTBOOL bVScroll=bScroll && (eAniDir==SDRTEXTANI_UP || eAniDir==SDRTEXTANI_DOWN); - if (!GetFitToSize() && (bWdtGrow || bHgtGrow)) + if (!bFitToSize && (bWdtGrow || bHgtGrow)) { Rectangle aR0(rR); long nHgt=0,nMinHgt=0,nMaxHgt=0; diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx index 411cd52a9e98..b70d7c715e03 100644 --- a/svx/source/svdraw/svdotxed.cxx +++ b/svx/source/svdraw/svdotxed.cxx @@ -69,7 +69,8 @@ sal_Bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl) rOutl.Init( nOutlinerMode ); rOutl.SetRefDevice( pModel->GetRefDevice() ); - const sal_Bool bFitToSize(GetFitToSize()); + SdrFitToSizeType eFit=GetFitToSize(); + FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); FASTBOOL bContourFrame=IsContourTextFrame(); ImpSetTextEditParams(); @@ -141,7 +142,8 @@ sal_Bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl) void SdrTextObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const { - const sal_Bool bFitToSize(GetFitToSize()); + SdrFitToSizeType eFit=GetFitToSize(); + FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); Size aPaperMin,aPaperMax; Rectangle aViewInit; TakeTextAnchorRect(aViewInit); @@ -325,7 +327,11 @@ void SdrTextObj::ImpSetTextEditParams() const Size aPaperMax; Rectangle aEditArea; TakeTextEditArea(&aPaperMin,&aPaperMax,&aEditArea,NULL); + //SdrFitToSizeType eFit=GetFitToSize(); + //FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); FASTBOOL bContourFrame=IsContourTextFrame(); + //EVAnchorMode eAM=(EVAnchorMode)GetOutlinerViewAnchorMode(); + //sal_uIntPtr nViewAnz=pEdtOutl->GetViewCount(); pEdtOutl->SetMinAutoPaperSize(aPaperMin); pEdtOutl->SetMaxAutoPaperSize(aPaperMax); pEdtOutl->SetPaperSize(Size()); diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx index 2639cc86543d..e23bc2f2b012 100644 --- a/svx/source/svdraw/svdotxtr.cxx +++ b/svx/source/svdraw/svdotxtr.cxx @@ -80,8 +80,7 @@ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect) if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139# if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1); if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1); - if (GetFitToSize()) - { + if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) { NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0)); } NbcAdjustTextFrameWidthAndHeight(); @@ -109,8 +108,7 @@ void SdrTextObj::NbcSetLogicRect(const Rectangle& rRect) if (bTextFrame) { if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1); if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1); - if (GetFitToSize()) - { + if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) { NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0)); } NbcAdjustTextFrameWidthAndHeight(); @@ -226,8 +224,7 @@ void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139# if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1); if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1); - if (GetFitToSize()) - { + if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) { NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0)); } NbcAdjustTextFrameWidthAndHeight(); diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src index 126e5f30812e..368fa4082520 100644 --- a/svx/source/svdraw/svdstr.src +++ b/svx/source/svdraw/svdstr.src @@ -1209,6 +1209,14 @@ String STR_ItemValFITTOSIZEPROP { Text [ en-US ] = "Proportional" ; }; +String STR_ItemValFITTOSIZEALLLINES +{ + Text [ en-US ] = "Fit to size (all rows separately) " ; +}; +String STR_ItemValFITTOSIZERESIZEAT +{ + Text [ en-US ] = "Use hard attributes" ; +}; /////////////////////////////////////////////////////////////////////////////////////////////////// String STR_ItemValTEXTVADJTOP { diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index ef42cb2d8fb6..b649f1b8c5a0 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -498,8 +498,9 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co Point aTemporaryTextRelativePosition(aLocalLogicPosition - aTextRect.TopLeft()); // FitToSize berueksichtigen - if (pTextObj->GetFitToSize()) - { + SdrFitToSizeType eFit=pTextObj->GetFitToSize(); + sal_Bool bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES); + if (bFitToSize) { Fraction aX(aTextRect.GetWidth()-1,aAnchor.GetWidth()-1); Fraction aY(aTextRect.GetHeight()-1,aAnchor.GetHeight()-1); ResizePoint(aTemporaryTextRelativePosition,Point(),aX,aY); diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx index 8d9f67d7f3cd..9937091de561 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -70,8 +70,8 @@ void SetAlignmentState( SdrView* pSdrView, SfxItemSet& rSet ) if( pObj->ISA(SdrObjCustomShape) ) { sal_Int32 nOldAlignment = nAlignment; - SdrTextHorzAdjustItem& rTextHorzAdjustItem = (SdrTextHorzAdjustItem&)pObj->GetMergedItem( SDRATTR_TEXT_HORZADJUST ); - SdrTextFitToSizeTypeItem& rTextFitToSizeTypeItem = (SdrTextFitToSizeTypeItem&)pObj->GetMergedItem( SDRATTR_TEXT_FITTOSIZE ); + SdrTextHorzAdjustItem& rTextHorzAdjustItem = (SdrTextHorzAdjustItem&)pObj->GetMergedItem( SDRATTR_TEXT_HORZADJUST ); + SdrTextFitToSizeTypeItem& rTextFitToSizeTypeItem = (SdrTextFitToSizeTypeItem&)pObj->GetMergedItem( SDRATTR_TEXT_FITTOSIZE ); switch ( rTextHorzAdjustItem.GetValue() ) { case SDRTEXTHORZADJUST_LEFT : nAlignment = 0; break; @@ -79,9 +79,9 @@ void SetAlignmentState( SdrView* pSdrView, SfxItemSet& rSet ) case SDRTEXTHORZADJUST_RIGHT : nAlignment = 2; break; case SDRTEXTHORZADJUST_BLOCK : { - if ( rTextFitToSizeTypeItem.GetValue() == sal_False ) + if ( rTextFitToSizeTypeItem.GetValue() == SDRTEXTFIT_NONE ) nAlignment = 3; - else + else if ( rTextFitToSizeTypeItem.GetValue() == SDRTEXTFIT_ALLLINES ) nAlignment = 4; } } @@ -302,11 +302,11 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem sal_Int32 nValue = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_ALIGNMENT))->GetValue(); if ( ( nValue >= 0 ) && ( nValue < 5 ) ) { - sal_Bool bFTS = sal_False; + SdrFitToSizeType eFTS = SDRTEXTFIT_NONE; SdrTextHorzAdjust eHorzAdjust; switch ( nValue ) { - case 4 : bFTS = sal_True; // passthrough + case 4 : eFTS = SDRTEXTFIT_ALLLINES; // passthrough case 3 : eHorzAdjust = SDRTEXTHORZADJUST_BLOCK; break; default: case 0 : eHorzAdjust = SDRTEXTHORZADJUST_LEFT; break; @@ -314,7 +314,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem case 2 : eHorzAdjust = SDRTEXTHORZADJUST_RIGHT; break; } pObj->SetMergedItem( SdrTextHorzAdjustItem( eHorzAdjust ) ); - pObj->SetMergedItem( SdrTextFitToSizeTypeItem( bFTS ) ); + pObj->SetMergedItem( SdrTextFitToSizeTypeItem( eFTS ) ); pObj->BroadcastObjectChange(); } } diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 05075b611f88..61666de0d5ac 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -1223,7 +1223,7 @@ SdrObject* SwWW8ImplReader::ReadTxtBox( WW8_DPHEAD* pHd, const WW8_DO* pDo, SetStdAttr( rSet, aTxtB.aLnt, aTxtB.aShd ); SetFill( rSet, aTxtB.aFill ); - rSet.Put( SdrTextFitToSizeTypeItem( sal_False ) ); + rSet.Put( SdrTextFitToSizeTypeItem( SDRTEXTFIT_NONE ) ); rSet.Put( SdrTextAutoGrowWidthItem(false)); rSet.Put( SdrTextAutoGrowHeightItem(false)); rSet.Put( SdrTextLeftDistItem( MIN_BORDER_DIST*2 ) ); @@ -2868,7 +2868,7 @@ SwFrmFmt* SwWW8ImplReader::MungeTextIntoDrawBox(SdrObject* pTrueObject, SfxItemSet aSet(pDrawModel->GetItemPool()); aSet.Put(XFillStyleItem(XFILL_NONE)); aSet.Put(XLineStyleItem(XLINE_NONE)); - aSet.Put(SdrTextFitToSizeTypeItem( sal_False )); + aSet.Put(SdrTextFitToSizeTypeItem( SDRTEXTFIT_NONE )); aSet.Put(SdrTextAutoGrowHeightItem(false)); aSet.Put(SdrTextAutoGrowWidthItem(false)); pSdrTextObj->SetMergedItemSet(aSet); diff --git a/vbahelper/source/vbahelper/vbatextframe.cxx b/vbahelper/source/vbahelper/vbatextframe.cxx index bef1424feea1..6a047c350b62 100644 --- a/vbahelper/source/vbahelper/vbatextframe.cxx +++ b/vbahelper/source/vbahelper/vbatextframe.cxx @@ -21,6 +21,7 @@ #include <vbahelper/helperdecl.hxx> +#include <com/sun/star/drawing/TextFitToSizeType.hpp> #include <com/sun/star/text/XText.hpp> #include <vbahelper/vbatextframe.hxx> @@ -37,8 +38,9 @@ VbaTextFrame::setAsMSObehavior() { //set property TextWordWrap default as False. // TextFitToSize control the text content. it seems we should set the default as False. + // com.sun.star.drawing.TextFitToSizeType.NONE m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap" ), uno::makeAny( sal_False ) ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextFitToSize" ), uno::makeAny( sal_False ) ); + m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextFitToSize" ), uno::makeAny( drawing::TextFitToSizeType_NONE ) ); } sal_Int32 VbaTextFrame::getMargin( rtl::OUString sMarginType ) diff --git a/xmloff/inc/pch/precompiled_xmloff.hxx b/xmloff/inc/pch/precompiled_xmloff.hxx index bc52eb37ffca..e8baac07b071 100644 --- a/xmloff/inc/pch/precompiled_xmloff.hxx +++ b/xmloff/inc/pch/precompiled_xmloff.hxx @@ -180,6 +180,7 @@ #include "com/sun/star/drawing/ShadeMode.hpp" #include "com/sun/star/drawing/TextAnimationDirection.hpp" #include "com/sun/star/drawing/TextAnimationKind.hpp" +#include "com/sun/star/drawing/TextFitToSizeType.hpp" #include "com/sun/star/drawing/TextHorizontalAdjust.hpp" #include "com/sun/star/drawing/TextVerticalAdjust.hpp" #include "com/sun/star/drawing/TextureKind.hpp" diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index 746484d99938..79863c575b5b 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/drawing/TextAnimationDirection.hpp> #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> #include <com/sun/star/drawing/TextVerticalAdjust.hpp> +#include <com/sun/star/drawing/TextFitToSizeType.hpp> #include <com/sun/star/drawing/MeasureTextHorzPos.hpp> #include <com/sun/star/drawing/MeasureTextVertPos.hpp> #include <xmloff/controlpropertyhdl.hxx> @@ -141,7 +142,7 @@ const XMLPropertyMapEntry aXMLSDProperties[] = GMAP( "TextVerticalAdjust", XML_NAMESPACE_DRAW, XML_TEXTAREA_VERTICAL_ALIGN, XML_SD_TYPE_VERTICAL_ALIGN, 0 ), GMAP( "TextAutoGrowHeight", XML_NAMESPACE_DRAW, XML_AUTO_GROW_HEIGHT, XML_TYPE_BOOL, 0 ), GMAP( "TextAutoGrowWidth", XML_NAMESPACE_DRAW, XML_AUTO_GROW_WIDTH, XML_TYPE_BOOL, 0 ), - GMAP( "TextFitToSize", XML_NAMESPACE_DRAW, XML_FIT_TO_SIZE, XML_TYPE_BOOL, 0 ), + GMAP( "TextFitToSize", XML_NAMESPACE_DRAW, XML_FIT_TO_SIZE, XML_SD_TYPE_FITTOSIZE, 0 ), GMAP( "TextContourFrame", XML_NAMESPACE_DRAW, XML_FIT_TO_CONTOUR, XML_TYPE_BOOL, 0 ), GMAP( "TextMaximumFrameHeight", XML_NAMESPACE_FO, XML_MAX_HEIGHT, XML_TYPE_MEASURE, 0 ), GMAP( "TextMaximumFrameWidth", XML_NAMESPACE_FO, XML_MAX_WIDTH, XML_TYPE_MEASURE, 0 ), @@ -626,6 +627,15 @@ SvXMLEnumMapEntry __READONLY_DATA pXML_VerticalAlign_Enum[] = { XML_TOKEN_INVALID, 0 } }; +SvXMLEnumMapEntry __READONLY_DATA pXML_FitToSize_Enum[] = +{ + { XML_FALSE, drawing::TextFitToSizeType_NONE }, + { XML_TRUE, drawing::TextFitToSizeType_PROPORTIONAL }, + { XML_TRUE, drawing::TextFitToSizeType_ALLLINES }, + { XML_TRUE, drawing::TextFitToSizeType_RESIZEATTR }, + { XML_TOKEN_INVALID, 0 } +}; + SvXMLEnumMapEntry __READONLY_DATA pXML_MeasureUnit_Enum[] = { { XML_AUTOMATIC, 0 }, @@ -1049,6 +1059,9 @@ const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nTy case XML_SD_TYPE_VERTICAL_ALIGN: pHdl = new XMLEnumPropertyHdl( pXML_VerticalAlign_Enum, ::getCppuType((const com::sun::star::drawing::TextVerticalAdjust*)0) ); break; + case XML_SD_TYPE_FITTOSIZE: + pHdl = new XMLEnumPropertyHdl( pXML_FitToSize_Enum, ::getCppuType((const com::sun::star::drawing::TextFitToSizeType*)0) ); + break; case XML_SD_TYPE_MEASURE_UNIT: pHdl = new XMLEnumPropertyHdl( pXML_MeasureUnit_Enum, ::getCppuType((const sal_Int32*)0) ); break; diff --git a/xmloff/source/draw/sdpropls.hxx b/xmloff/source/draw/sdpropls.hxx index c4fcca1c339a..b5befc3d1161 100644 --- a/xmloff/source/draw/sdpropls.hxx +++ b/xmloff/source/draw/sdpropls.hxx @@ -75,6 +75,7 @@ extern const XMLPropertyMapEntry aXMLSDPresPageProps_onlyHeadersFooter[]; #define XML_TYPE_TEXT_ANIMATION_STEPS (XML_SD_TYPES_START + 24 ) #define XML_SD_TYPE_TEXT_ALIGN (XML_SD_TYPES_START + 25 ) #define XML_SD_TYPE_VERTICAL_ALIGN (XML_SD_TYPES_START + 26 ) +#define XML_SD_TYPE_FITTOSIZE (XML_SD_TYPES_START + 27 ) #define XML_SD_TYPE_MEASURE_HALIGN (XML_SD_TYPES_START + 28 ) #define XML_SD_TYPE_MEASURE_VALIGN (XML_SD_TYPES_START + 29 ) #define XML_SD_TYPE_MEASURE_UNIT (XML_SD_TYPES_START + 30 ) |